DEV Community

Discussion on: # of ways to loop Array in JavaScipt

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Alright let's give this a shot.

  • Recursion
  • .forEach
  • .map
  • .every
  • .some
  • .flat
  • ... You get the point, mostly all of the array methods loop under the hood
  • For loop (of)
  • For loop number or length based
  • (cheating here) labeled for loop
  • while loop
  • do while
  • setInterval
  • generator
  • itterator
  • pass to Wasm
  • aws lambda posted
  • manually typing array[n]
  • deprecated! For each in

Any more for anymore anyone?

Collapse
 
akashpreet profile image
Akash P

.filter

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

"You get the point, mostly all of the array methods loop under the hood"

That covers filter and find

Collapse
 
akashpreet profile image
Akash P

One of the resourse I found in #devcommunity by @florinpop17
dev.to/florinpop17/24-javascript-a...

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Unfortunately this sort of artical goes out of date quite quickly. Missing Array.prototype.flatMap()

Always best to Google.

Thread Thread
 
akashpreet profile image
Akash P

Fact (PERIOD).