CHAPTER THIRTEEN

JavaScript Is Cutieful

All This Loose Beauty

JavaScript is beautiful, and I can say that with certainty, for beauty is in the eye of the beholder, and in the hands of that beholder is a language soft as plasticine that will mold and change at will and not protest against maltreatment, and will trust the code it’s given as though it were the word of God.

Beauty, I suppose, is a rather personal thing. Some detest the rain, and others cry in it and feel the force of life itself in drops as it hammers on their skin.

And so, in JavaScript.

Some fear and remonstrate against a single use of anything not sanctioned by ancestral coders in whom they’ve learned to place their trust. As though experimentation, thought, invention, play, discovery, and learning were some capital offense.

Some of the authors in this book have quite deftly shown the beauty in the structure and the safety of those parts of the language we’ve accepted as permissible.

Others have, with expertise and confidence and thorough knowledge of their craft, demonstrated elegance and let us see the power and succinctness that these oft lambasted features can grant a learned user.

The Absurdity of Dalí

The work of Dalí is often absurd, disturbing, strange, enchanting, comical, and surprising—and it is beautiful.

I want to explore a part of JavaScript that captures that same kind of beauty for me.

Dalí’s JavaScript

Array.apply(null, { length: 10 }).map(eval.call, Number)
// → [0, 1, 2, 3, ...

Get Beautiful 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.