All I Want for Christmas: Effective JavaScript — Book Giveaway

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

Effective JavaScript” is a new book by experienced developer David Herman, taking an in-depth look at JavaScript, with information and advice on how to write more portable, robust and maintainable apps and libraries.


Why I wanted this book

In the course of my day job, I write a fair amount of JavaScript and am reasonably proficient at the “normal stuff”, such as making AJAX requests or manipulating the DOM. However, of late I have felt a growing need to get to grips with the inner workings of the language, and attempt to grok some of its more complicated concepts. That’s why “Effective JavaScript” by David Herman was right up there on my Christmas wish list.

The experience so far

The book surpassed my expectations. David (a senior researcher at Mozilla and serving member of the TC39 committee) takes us on an in-depth tour of the language, covering everything from prototype-based object-oriented programming to JS programming patterns and idioms. Along the way, he illuminates many of the language’s pitfalls whilst providing a wealth of realistic use cases. Doubly pleasing was the fact that the book is structured around 68 “items”, meaning that it can be dipped into at will, read in any order and/or used as a reference book.

As a self-taught coder this book has helped me fill several gaps in my knowledge. It is well-written, concise (200 pages) and I can heartily recommend it to anyone wanting to take their JS skills to the next level.

What’s your favorite JavaScript tidbit? Answer in the comments, we’ll pick the best one and send you a copy of Effective JavaScript.


  1. I think the classic IIFE (Imediately Invoked Function Expression) is likely one of the slickest concepts.

      //add your magic here

    With the ability to run your private code within it, be able to pass in whatever you want access to into it, and not pollute the global scope?.. Priceless!

  2. My favorite javascript tidbit is:

    alert (“I’m working.”)

    Being a newbie, this is the best and easiest way to test whether the damn thing is running or not. :confused:

    So clearly I need this book more than the lot of you :smiley:

  3. My favourite one of the past year or so has been classList protocol to let you easily manipulate the class names of an element.

  4. var haveBook = Math.round(Math.random());
        function getBook() {
            return (haveBook !== 0) ? "Congrats!" : "Too bad.. next time";

    Ternary rocks…
    Hello hello! I’d love to have this book, I’m thirsty for javascript!!

  5. Jeremy Keith describes a neat way to manage breakpoints so that you don’t have to declare them in two places, once in CSS, and again in JavaScript. This involves a little bit of CSS, and a nice tidbit of JavaScript:


    @media all and (min-width: 45em) {
        body:after {
            content: 'widescreen';
            display: none;


    if(window.getComputedStyle) {
        if (size.indexOf("widescreen") !=-1)
            // do something
    } else {
        // add default for IE8

17 more replies