What is the purpose of `Array.prototype.forEach()`?

JavaScript Associate Easy

JavaScript Associate — Easy

What is the purpose of `Array.prototype.forEach()`?

Key points

  • forEach() does not return a new array
  • It executes a callback function for each element
  • The return value is always undefined
  • Useful for performing operations on array elements in place

Ready to go further?

Related questions