DEV Community

bomoniyi
bomoniyi

Posted on

JS features to master

/* 
- map()
- filter()
- reduce()
- some() / every()
- find() / findIndex()
- forEach()

Plus:

- slice()
- concat()
- includes()
- array spread operator
*/

const numbers = [1, 2, 3, 4, 5];
// instead of this
for (let i = 0; i < numbers.length; i++) {
  console.log(numbers[i]);
}
//  use this
numbers.forEach(number => {
  console.log(number);  
});

Enter fullscreen mode Exit fullscreen mode

Top comments (0)