All about arrays
Arrays are lists lists of of data.
Array.prototype.forEach()
The forEach array method takes a callback function as a
parameter, and will run the callback on each item of the array.
Array.prototype.map()
The map array method takes callback function which runs on
each item in the array, and will create a new array.
Array.prototype.reduce()
The reduce array method takes callback function which runs on
each item in the array, and will a single value.
The callback function takes two parameters
(previousValue, currentValue). In addition to a callback
function, the reduce method also takes a parameter for
initial value.
reduce(callbackFunction, startValue)
Challenge 1
Solution 1
Challenge 2
Solution 2
press 'run' to view console output