O'Reilly logo

Beautiful JavaScript by Anton Kovalyov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required