I am unable to clearly understand the usage of the arguments of forEach() in javascript.
( I understand the first one is the function which will be called on each element of the array. )
Here are my questions:
1) What is the second argument used for? Can anyone give an example?
2) Does the function (the first argument) always have 3 arguments: entry, index and array?
3) Also some websites explain Array.prototype.forEach(). Is this the same forEach() or is this anything different?
Here is my jsfiddle.
I tried in vain to search online for a simple explanation! Thanks for the help.