javascript return values in object as array using for in code example
Example 1: javascript object to array
const numbers = {
one: 1,
two: 2,
};
console.log(Object.values(numbers));
console.log(Object.entries(numbers));
Example 2: array objects to array of one property
let result = objArray.map(a => a.foo);
Example 3: Getting One Value from an Array of Items
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
var total = numbers.reduce(function(total, current) {
return total + current;
}, 0);
console.log(total);