return function on array elements javascript code example
Example 1: can you return 2 values in javascript object
function friends(){
var names = {
closeCircle: ['bebo','eli','matthew'],
outerCircle:['vierie','nate','james','george'],
};
return [names.closeCircle[0], names.closeCircle[2]]
//returns bebo and matthew
}
Example 2: return array javascript
function func() {
return [5, "string", {a: 7}];
}