What is the output of the following code? const log = console.log.bind(console); [1, 2, 3].forEach(log);

JavaScript Professional Hard

JavaScript Professional — Hard

What is the output of the following code? const log = console.log.bind(console); [1, 2, 3].forEach(log);

Key points

  • The forEach method in JavaScript passes three arguments to the callback function.
  • The first argument represents the current element in the array.
  • The second argument represents the index of the current element.
  • The third argument represents the array itself.

Ready to go further?

Related questions