jskatas.org Continuously Learn JavaScript. Your Way.

Array API: array.find()

Array.prototype.find() finds one item in an array.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Array.prototype.find makes finding items in arrays easier

  • takes a compare function
  • returns the first value found
  • returns undefined when nothing was found
  • combined with destructuring complex compares become short