Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript sum array of objects

arr = [{x:1}, {x:3}]

arr.reduce((accumulator, current) => accumulator + current.x, 0);
 
PREVIOUS NEXT
Tagged: #javascript #sum #array #objects
ADD COMMENT
Topic
Name
3+7 =