I am having trouble trying to understand the code below. I'm coming from a Java background. How should I read this? Is there any good Java > Javascript books/tutorials I should be looking at?
function sum(numbers) {
var total = 0;
forEach(numbers, function (number) {
total += number;
});
return total;
}
show(sum([1, 10, 100]));
Extracted from http://eloquentjavascript.net/chapter6.html
I'm looking at the forEach(numbers, function (number)... code. Where will the anonymous function get the 'number' from?