Not enough Developers know these JavaScript programming tips.
reduce(), some(), and every() can make your code cleaner and easier to read, here's how they work:
1.
1a) JavaScript reduce() method is explained in a complex way IMO by MDN & other docs — here’s my simpler definition.
reduce() runs a calculation on every element of an array & passes the result of previous iterations. It returns the result once all elements have been processed.
1b) If you want to dig deep into the JavaScript reduce() method, MDN docs is a good resource.
Hopefully, my illustration made it a lot easier to understand than the long complicated docs 😅