how to get data from array of objects in javascript code example

Example 1: array objects to array of one property

let result = objArray.map(a => a.foo);

Example 2: how to get array from object in javascript

let result = objArray.map(({ foo }) => foo)

Example 3: Getting One Value from an Array of Items

//Getting One Value from an Array of Items or sum of array
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);