I saw somewhere the code snippet:
list.forEach(callback, this);
I understand 'forEach' loop except 'this' keyword used here, what does 'this' mean?
if I convert list.forEach(callback) to normal for loop, I think it is:
for(var n=0; n<list.length; n++){
callback(list[n]);
}
But what does 'this' means in forEach(callback, this) ? With this, what need to be added if I convert it to normal for loop like above?
list.forEach(callback, this);appear in? Without knowing this we cannot possibly say whatthisis