re: What The For Loop? VIEW POST

VIEW FULL DISCUSSION
 

What if you were asked to do this without a for loop? ;)

 

in that case, see some of the other clever comments to the post :)

 
 

Or better yet ... use some functional programming!

Array(20)
  .fill()
  .map((_, i) => i + 1)
  .filter((num) => num % 2 !== 0)
  .join('\n')
code of conduct - report abuse