Michael Douglas Brett - Web Development

Hi, I'm Michael. I'm a front-end web developer based in the UK. This is my site.

A Single Source of Truthyness

JavaScript Podcasts Learning

Nov 11th 2015

Kyle Simpson (Getify) - author of the book series 'You Don't Know JS' - was a recent guest on Scott Hanselman's 'Hanselminutes' podcast. During the conversation he said something about what makes JavaScript developers different that really struck home with me.

When I ask a question of a JavaScript audience, I will ask a question like: 'How many of you have ever opened up and read any part of the JavaScript specification?', and I might - in a room of thirty people - get one, maybe two hands... but if you ask that same question of a room full of C++ developers, or Java developers, you get most of the hands up.

My hand would have definitely stayed down. If I have a problem that I'm scratching my head about, my usual course of action is to jump on Google and wade through blog posts, tutorials and StackOverflow answer threads till I stumble across a solution that appears the most 'right'. It's painful to admit that going to the spec (up till now) never even entered my head.

This is even despite being a fan of Getify's books, books that actively encourage you to not take things for granted and try to look closely at what is actually going on in the language. I suppose I had to actually hear him say it for it to really sink in.

After listening to the podcast, I went back and looked at what 'You Don't Know JS' says about one of the more problematic parts of the JavaScript language: == and != (what Douglas Crockford calls the 'Evil Twins'). The rule of thumb if you've read 'JavaScript: The Good Parts' is that you steer clear of the Evil Twins as they employ type coercion and can catch you out. The problem is that, according to Mr Crockford:

The rules by which they do this are complicated and unmemorable.

Getify's rebuttal to the issue of complicated rules is pretty spot on:

I believe this is a flawed premise -- that you readers are competent developers who write (and read and understand!) algorithms (aka code) all day long.

So I went and looked at the spec, and to quote DC out of context:

In that moment, I achieved enlightenment.

I didn't find the rules to be that complicated (and I'm a n00b). He might be right about them being unmemorable, but we are talking about a context in which we are almost inevitably connected to the web as we work. The spec is not much more than a bookmark away (especially now I've bookmarked it).

I found that reading the specification, in order to deepen my knowledge and understanding, to be hugely empowering (even just on this one issue). I've noticed that the people that inspire me the most when it comes to web development, people like Sara Souiedan, Kyle Simpson, PPK (to name just three, there are obviously many more) are the people that have obviously taken the time to dig deep into a subject.

Am I going to throw == in everywhere now? Nope. But I will use it where appropriate, and if I do it will be because I've made an active decision to do so. More importantly, will I revisit the JavaScript spec in the future? Absolutely. Learning is fun, and gaining deeper knowledge makes it all the more rewarding.

Kyle Simpson on Hanselminutes

You Don't Know JS

JavaScript: The Good Parts