What is the third parameter for a forEach callback function in JavaScript
I know that forEach in JavaScript calls my callback function with three parameters:
arr.forEach(function callback(currentValue, index, array) {
//your iterator
})
In the above example arr
both array
are the same arrays and arr
exist in the closure of the callback function.
Now the question is, what is the point of passing array
the callback function?
+3
source to share