All I Want for Christmas: If Hemingway Wrote JavaScript

We asked SitePoint authors what developer toys they would want for Christmas, then managed to source them — without relying on Santa.

If Hemingway Wrote JavaScript is exactly what it sounds like: A thought experiment as to how 25 well-known literary figures would tackle various JavaScript problems.

From the titular Ernest Hemingway (whose solution is terse and effective, as you’d expect), to post-postmodern darling David Foster Wallace (whose solution is long, discursive, and references his background in mathematics), pretty much everyone famous for writing in the last few centuries takes a stab at coding their way to a solution for a given problem.

The book is written by Angus Croll, on Twitter’s UI team, who knows a bit about JavaScript.

If Hemingway Wrote JavaScript

Angus Croll / No Starch Press

Why I Wanted This Book

Given I work on the content side of a technical publication like SitePoint, something that fell in the middle of those two worlds had an instant appeal. I know a bit about literature, and I like the idea of knowing a bit about JavaScript, although I haven’t quite gotten there yet. This seemed like a way to indirectly learn a bit more about the language while indulging my literary side.

The Experience So Far

I hadn’t expected to laugh so much at a bunch of code. This is a very clever, impressive book, full of amusing examples that show the versatile (or is it chaotic?) nature of both JavaScript and the English language. I haven’t covered every author yet, but some unexpected delights came from Tupac’s solution, incorporating rhyme and flow, and J.K. Rowling’s magical code.

Unsurprisingly, Kafka’s solution leads (Metamorphizes?) to a crushing bug, leading his code to recur endlessly. As Croll says, “very Kafkaesque”. A fitting end to a worthwhile read.

Which author, lyricist, stand-up comedian or orator would you want to see code? Answer in the comments, we’ll pick the best answer and send you a copy of the book!


  1. ralphm says:

    I’m looking forward to reading the book. But from my experience of trying to learn JavaScript, if Hemingway had learned JS I expect he still would have killed himself … only earlier.

    Which author, lyricist, stand-up comedian or orator would you want to see code?

    I think maybe Thomas Hardy. It would be beautiful to read, picturesque and romantic, but at the same time utterly pessimistic and defeatist … which more corresponds to how I usually feel. (Those upbeat authors are insufferable!)

  2. ralphm says:

    It would be orcward, indeed.

  3. I would love to read Douglas Adams’ javascript style, full of nonsensical characters and situations, even though we all know there will be only one answer in the end, “The Answer to the Ultimate Question of Life, the Universe, and Everything.”

  4. Samuel Beckett’s would probably be like this:

  5. Yes it is nice. What was asked in the original post was just for who we’d want to see in code, not for examples of code itself.

    We must ensure that we’re not giving the impression of putting people down. Good job @katja_bak on your efforts here.

8 more replies