Hacker News new | ask | show | jobs
by pgambling 5098 days ago
Here are a couple book recommendations for those of you looking to improve your JavaScript:

"JavaScript: The Good Parts" by Douglas Crockford "JavaScript Patterns" by Stoyan Stefanov

2 comments

The Crockford book is 4 years old now, is it still considered to be a good book to pickup? I've done JS off and on for a while, but mostly haphazardly (with an emphasis on the hazard). I'm looking to start doing some backbone.js and jquery and a book to help start off with it.
Despite being a small book you can ignore a good third of it, and I think his constructor pattern is out of date? but - it does do a good job of explaining the actually idiosyncratic thing about js - the whole prototype chain thing, and the scoping.
Even though I recommended the book, I completely agree with you.
If four years would be enough to change a lot about the core JavaScript language, there wouldn't be a need for the book in the first place. It's still quite modern enough, and will be until a major EcmaScript overhaul is propagated and accepted by all common browsers…

It's not about modern web techniques, which is why it aged that well. For those, I'd personally recommend pulling apart some modern webapps or libraries, or reading modern tutorials. Usually you're somewhat outdated once your book reached its publisher… (Having said that, JavaScript Patterns is also pretty neat)

And if you want more of Crockford's advice, he's done a talk about ES5 changes (which you should really watch, they are great)
I've been working on following the good parts for my latest project. I've started to cringe any time people talk about the prototype or using "this"
That's unfortunate. Properly using prototypes and "this" is the only way to do high-performance JavaScript with objects.

Get cozy with them -- they're useful.

It isn't the only way, it's just that browser JS engines tend to be optimised for them.
I believe your statement is therefore equivalent to the preceding one.
I cringe when people claim to be writing more than the most basic JS and aren't using prototypes.
It's a style choice. You don't have to use classes and/or do anything with the prototype chain.
> It's a style choice

No. max line lengths is a style choice. indenting with spaces vs tabs is a style choice brace position is a style choice

Using prototypes and instances in JS is about using the right tool for the job.