DEV Community

Discussion on: Array methods you must know as a JavaScript Developer

Collapse
maxart2501 profile image
Massimo Artizzu

Here are my tips on array methods:

  • avoid mutating methods;
  • push and sort are acceptable but be extra careful;
  • splice is also very slow, and if you need to use it, you're using a mutable approach and that's a bad practice;
  • includes is a very expressive method;
  • flat is great;
  • reduce has received some backlash lately... and it's probably justified;
  • none knows why this method even exists (spoiler alert: some actually know).
Collapse
siradji profile image
Suraj Auwal Author

That's very helpful Massimo.