DEV Community

be careful with .forEach()

Zach on June 16, 2021

I finally got around to solving one of the toy problems that I couldn't completely solve in the pre-course the diagnostics. My issue was that I di...
Collapse
 
daviot profile image
Daviot

Hi
Solid solution, you could also use .some((item, index,arr)=>{return item > 255}). Which returns an boolean.
Sorry for commenting on your note.

Collapse
 
zbretz profile image
Zach

Thanks for adding that. Yeah that's a nice way of applying what i've learned to call 'functional programming'. Functions like filter/reduce/etc and .some are pretty slick. This is a great use of it. Really nice. Thanks!

Collapse
 
zbretz profile image
Zach

I used .some today!

Wrote a sentence or two about it here. Just thought I'd send you a thanks for sharing it with me.