What's the best book to read about JavaScript?

14 points by lowry ↗ HN
I am an old Java programmer and while I occasionally change Angular directives or play with Vue, I have little knowledge about the inner workings of JavaScript. I am afraid that most JavaScript books are outdated in a world ruled by transpilers and linters or they lay out the knowledge in a 'how-to' manner instead of explaining how-it-works.

9 comments

[ 2.9 ms ] story [ 26.2 ms ] thread
Four major suggestions:

- "Eloquent Javascript" is an excellent introduction to JS from the ground up: http://eloquentjavascript.net/

- The Mozilla Developer Network docs are a comprehensive set of references for the JS language and web APIs: https://developer.mozilla.org/en-US/docs/Web/JavaScript

- Dr. Axel Rauschmayer's books are the best "full reference" books for all of JS syntax and behavior: http://exploringjs.com/

- Kyle Simpson's "You Don't Know JS" is a deep dive into the way the JS language works: https://github.com/getify/You-Dont-Know-JS

I also have links to some additional meta-resources as part of my React/Redux links list: https://github.com/markerikson/react-redux-links/blob/master... .

(comment deleted)
Not books per se, but you are probably interested in frontend specific stuff, as you mentioned Angular and Vue. (Not directly inner workings, but somewhat linked):

Coding Style: As a quick reference and to learn about some bad patterns (and how to avoid them), I can recommend the airbnb style guide [1]. They also link to eslint rules, which always have a reasoning why a rule is considered, e.g. the no new object rule [2]. A really interesting thing in the code style corner is prettier, which auto-formats source code pretty [3].

References: The Mozilla Developer Reference Manual, e.g. for String.match [4]. It also has explanations for browser APIs. To check if you already can use a certain browser feature, I recommend caniuse [5]

Now, as you also mentioned your an "old Java Programmer". I think it's quite interesting what goes on the JavaScript space and which features are ~~stolen~~ borrowed from which language. Good search queries to understand the language and it's features (especially the new ones) would be

- Javascript Classes vs Prototype

- Javascript Decorators

- Javascript Arrow Functions (Lambda)

- Node.JS Streams

- Reactive Extensions

- Flow vs. TypeScript

Well I hope that some of that info is usable for you, if you have any detail questions, please just comment :)

[1]: https://github.com/airbnb/javascript

[2]: http://eslint.org/docs/rules/no-new-object.html

[3]: https://github.com/prettier/prettier

[4]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

[5]: https://caniuse.com/

To me, JavaScript: The Definitive Guide is worth having because it explains and documents vanilla JavaScript. In particular, I found its separation of the abstractions:

1. JavaScript as programming language

2. JavaScript as a browser API

particularly helpful in so far as it lets me evaluate information in blogs and StackOverflow answers and elsewhere. Often these two different meanings of 'JavaScript' are interwoven and it created confusion for me.

Good luck.

Kyle Simpson's books.

His books transformed my understanding of Javascript. He basically bursted into the chest of Javascript, grabbed its beating heart, and then pulled it out and showed me (just like in "Indiana Jones and the Temple of Doom").

His series "You Don't Know JS" gives you a profound understanding of the language. It really teaches you why JS does all of the weird things it does.

I wasted a lot of time by not reading those books earlier.

Also "Professional Javascript for Web Developers" by Zakas is a pretty classic text too. Gives you a ton of background on Javascript, not as much as Simpson though (but the alternate perspectives are useful). Where this book really helps is by explaining how the browser works. Things like the DOM and "document" and "window" along with the HTML5 APIs aren't Javascript but you need to know them as well.
I second this. Those books are available for free and are worth reading for everyone working with JS. You'll understand about the variety quirks/perks of the language. Best read on JS IMO.

If you wanna learn about the HTML 5 APIs, you should check out html5rocks.

Ctrl Shift J - source tab