This is a card in Dave's Virtual Box of Cards.

My JavaScript: The Good Parts

Page created: 2026-04-29

This was originally a sub-section of the JavaScript card.

Like Douglas Crockford, I have my own idea of "JavaScript: The Good Parts". My list is just way shorter. His is a book. Mine could be tattooed on your arm: [] {} function.

I like two fundamental things about JavaScript.

The first thing is the no-fuss object and array literal syntax:

var foo = {
    bar: "Hello",
    biz: "World",
    baz: [1,2,3,4],
};

The second is first-class functions with closures:

function honk(x){
    return function emit(){
        alert(x);
    }
}

var honk1 = honk("Blooooop!");
var honk2 = honk("Blattt!");

honk1(); // alerts "Blooooop!"
honk2(); // alerts "Blattt!"

Between those two building blocks, you can construct just about anything in a huge variety of styles.

Most of what makes working with JavaScript unpleasant has more to do with the insanely bad browser APIs (many of which are way better now than they used to be), the Node.js ecosystem, and the way people try to use JavaScript like Java with classes, inheritance, and all that nonsense. I don’t use the prototypal inheritance system at all, if I can help it.

The tiny core of JavaScript, if you use it consistently and ignore the weird stuff, is actually extremely pleasant, compact, and elegant.