I am trying to create a new array with just the object values of myArray. My code below returns newArray with both Objects stored, but I am stuck on how to get the 'values' out and put them into the array. I am used to for-in on Objects, but not sure how to access objects when they are stored in an Array.
var myArray = [{first: 'michael', last: 'jordan'}, {first: 'brett', last: 'favre'}];
var myFunc = function (values) {
newArray = [];
for (var i = 0; i < values.length; i += 1) {
newArray.push(values);
}
return newArray;
}
[ 'michael', 'jordan', 'brett', 'favre' ]?