You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
506 B
31 lines
506 B
console.log('w');
|
|
|
|
|
|
var sheepShearers = [
|
|
{
|
|
name: "Tim",
|
|
age: 20,
|
|
sheepCount: 18
|
|
},
|
|
{
|
|
name: "C3PO",
|
|
age: 200,
|
|
sheepCount: 320
|
|
},
|
|
{
|
|
name: "Cousin It",
|
|
age: Infinity,
|
|
sheepCount: 2900
|
|
}
|
|
];
|
|
|
|
|
|
var total = sheepShearers
|
|
.map(function(item) {
|
|
return item.sheepCount;
|
|
})
|
|
.reduce(function(sum, num) {
|
|
return sum += num;
|
|
});
|
|
|
|
console.log(total); |