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.
53 lines
945 B
53 lines
945 B
// words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"];
|
|
//
|
|
// words.forEach(function (e){
|
|
// console.log(e.toUpperCase());
|
|
// });
|
|
|
|
|
|
/////////////////////
|
|
|
|
|
|
// more_words = ["Joe", "Overreats", "Eggs"];
|
|
//
|
|
//
|
|
// var new_arr = more_words.map(function (i){
|
|
// return i.charAt(0);
|
|
// });
|
|
//
|
|
// console.log (new_arr);
|
|
|
|
///////////////////
|
|
|
|
// arr = [8, 8, 8, 8, 8, 8, 8, 8];
|
|
//
|
|
// new_value = arr.reduce(function(product, n){
|
|
// return product *= n
|
|
// });
|
|
//
|
|
// console.log(new_value);
|
|
|
|
/////////////////////
|
|
|
|
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(e){return e.sheepCount})).reduce(function(sum, num) {resturn sum += num;});
|
|
|
|
console.log (total);
|