Node.js examples for Array:Array Operation
Arrays are mutable, Passed by sharing
/**/*from w w w . j a v a 2s.c om*/ * Arrays are mutable * Passed by sharing */ function sum(numbers){ numbers.push(numbers.reduce(function(prev, num){ return prev + num; }, 0)); } var numbersToAdd = [1, 2, 3]; sum(numbersToAdd); console.log(numbersToAdd);