Chapter 2 Manage Data Collections with Arrays

The ancient Greek poet Archilochus wrote, “A fox knows many things, but a hedgehog one important thing.” The great historian Isaiah Berlin said all thinkers are either hedgehogs or foxes. I think the same is true of syntax.

As you’ve seen, const is a hedgehog. It can only do one thing—make an unchanging declaration. By only doing one thing, it makes your code readable and predictable. As you’ll see in upcoming tips, array methods are all hedgehogs. They can do only one thing on an array. But they do it well, so you can safely predict outcomes without diving into the details.

For the most part, you want to stick with syntax that does one thing very well. But there are times when you need ...

Get Simplifying JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.