DEV Community

Discussion on: be careful with .forEach()

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.