parent
719549e305
commit
4fca94be34
@ -0,0 +1,52 @@
|
|||||||
|
// 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);
|
||||||
Loading…
Reference in new issue