2

I am new to JavaScript and am currently reading about arrays. I saw the following code on the documentation about how how some objects do not share the array methods and a workaround:

Array.prototype.forEach.call(arguments, function(item) {
  console.log(item);
});

Specifically the prototype.forEach.call(arguments have not seen that before. From the .call documentation the first argument is the this object yet an arguments object is provided here. Can anyone walk me along what is happening here?

Robert
  • 10,126
  • 19
  • 78
  • 130

0 Answers0