TIL23 - JS - Iteration Methods

Peter D Lee·2020년 8월 31일
0

JavaScript

목록 보기
12/19

In JavaScript, in addition to using loops, you can also use built-in array methods, which provide a preset way of performing iteration on arrays

These built-in array methods are called iteration methods (aka iterators)

Commonly used iteration methods:

  • .forEach() - return value: undefined
  • .map() - return value: new array
  • .filter() - return value: new array
  • .findIndex() - return value: index number
  • .reduce() - return value: a single value
  • .some() - return value: boolean
  • .every() - return value: boolean

All iteration methods in JavaScript take in a callback function

Syntax and other information on how to use the iteration methods can be found in the MDN documentation for each array method

0개의 댓글