Say I have the following array:
var BUILDINGS = [
    { production: {"numberProd": 6}},
    { production: {"numberProd": 11}},
    { production: {"numberProd": 14}},
];
I'm trying to use reduce() to add up the sum of these productions. I've tried to the following:
BUILDINGS.reduce(function(a,b) {return a.production.numberProd + b.production.numberProd});
But when I run the code I get the value NaN.
I was wondering how to properly set up the reduce() statement.
Thank you!
 
     
     
    