Array functions and the rule of least power | Jesse Duffield

The various array methods in JavaScript can be thought of on a scale of power, or really flexibility. At the top end you've got the for loop, at the bottom the highly-specific functions .every and .some. Jesse makes the argument that you should always choose the least powerful option and I agree. The article is also just a generally excellent overview of array manipulation in JavaScript.

Circle chart showing how each array function can effectively be nested in those more powerful, with the for loop around them all, then "for each", reduce, both map and filter at the same level, and within filter find, then every and same together.
An incredibly useful reference guide to array functions.

Explore Other Notes

Newer

Turn music into visual magic

Astrofox looks like a really clever video editor, developed specifically with the aim of creating videos for music playlists and personal tracks. Nothing too fancy, but lots of options to animate […]

Older

Digital garden seedlings

Whilst falling down the rabbit-hole of digital gardening I found some of Maggie's tweets incredibly insightful and useful, yet somehow totally missed her own digital garden (and her entire related […]
  • The various array methods in JavaScript can be thought of on a scale of <em>power</em>, or really flexibility. At the top end you've got the for loop, at the bottom the highly-specific functions [&#8230;]
  • Murray Adcock.
Journal permalink

Made By Me, But Made Possible By:

CMS:

Build: Gatsby

Deployment: GitHub

Hosting: Netlify

Connect With Me:

Twitter Twitter

Instagram Instragram

500px 500px

GitHub GitHub

Keep Up To Date:

All Posts RSS feed.

Articles RSS feed.

Journal RSS feed.

Notes RSS feed.