Ask HN: Best current book to learn JavaScript?

183 points by babyboy808 ↗ HN

98 comments

[ 3.9 ms ] story [ 177 ms ] thread
You don't know JS is a good book to start with and explains ES6 too.

It is available for free on github so you can evaluate before buying.

https://github.com/getify/You-Dont-Know-JS

I think this is more for someone already familiar with the foundation level than for a beginner
The irony of a book called "You Don't Know JS" not in fact intended for people who don't know JS. :)
Idk, I always interpreted it as a conversation, where you the reader are saying "I know javascript" and Kyle Simpson says that you don't, which is how the book is intended.
I've taken a few of his online courses and he does an excellent job telling someone they don't know js, without coming off arrogant. I think it's mostly because he can explain most issues in depth but as a previous comment pointed out, it isn't really a beginner series. Although, I am not sure "[learning] javascript" necessarily means that the learner is completely inexperienced.
I get the understood meaning - I was just making a joke. :)
This series of books took me to the next level in my career as a developer
I love books in markdown. I can read it with emacs, and automatically ferry the code snippets to a javascript buffer.

I wish more authors would publish the markdown or asciidoc. I'd pay for it.

Eloquent javascript is also fantastic. http://eloquentjavascript.net/
I think this is the best beginners book for sure. In case anyone is wondering, it doesn't teach ES6, but it does teach veey grounded Javascript ideas and it won't be difficult to catch up with the latest changes to JS after learning from this book. It's also free!
My go to for people new to JS.
I'm learning Javascript. I can safely say im comfortable with most fundemental programming concepts...then the book starts talking about recursive functions.

Suffice to say once I hit that section I went back to codeacademy finished the course (which never brought them up and I'm not sure if that's good or bad) now I'm back in Eloquent Javascript...it get's really hard really fast.

Not having any real experience with JS programming, is this talking about privately named functions (e.g. var MyFunction = function MyHiddenName (blah){}) or was this not being familiar with recursion? Or is there something else funky in JS that I just don't know about?
He's talking about recursion - a function calling itself. I find it's funny that factorials are understood easily in high school, but then recursion is mind blowing in front of a computer. Just like factorials, it can be understood best by walking through it with paper and pencil.

The examples in Eloquent Javascript need to be studied by the reader to get the most out of that book. I think people just glance at them with out typing them up and running them.

recursive function is just a fancy word for a function that calls itself.
Lot's of books throw recursion at beginners and expect them to understand it as intuitively they would a loop. But it's not intuitive at all (at least it wasn't for me).

I like the book "The Little Schemer" to learn recursion. Yes, a whole book to learn something other books briefly throw at you. You will not regret the read.

Depends on what your level is going in.

For an absolute beginner, JavaScript and jQuery by Jon Duckett is extremely accessible. Sure, it covers jQuery but it's so well aimed at total beginners it's not a bad path.

At the lower intermediate level, Eloquent JavaScript (mentioned elsewhere) is fantastic.

At higher levels/if you know other languages and are comfortable learning new ones: Effective JavaScript, YDKJS, and Speaking JavaScript all fantastic and complement each other in various ways.

nice book. do you know if this person plans on finishing part 3?
I think there is. The original author was consulting at the time it was written and he released the book right at ES6 took headwind. Another contributor has a fork and they are currently working to get the book up to date with ES6. Once that is done I am sure they will move on to part 5.

https://github.com/MostlyAdequate/mostly-adequate-guide/pull...

This book is FANTASTIC to understand functors & monads. Not sure it is a good resource to learn the Javascript language. (but if you are beyond the beginner level, I highly recommend it, it really rocks!)
(comment deleted)
Forget books, start coding!! To get going, CodeAcademy.com is amazing!!
Codecademy is good for the absolute basics, but I found anything beyond that seriously lacking.

I remember really hating the tutorial on 'How to use APIs with Javascript', for example. It basically told me exactly what to type in and I 'passed' the course without understanding any of it.

I had the same experience, it gives a false sense of security. I can pass the courses without having even a remedial understanding of the underlying concepts.
Yes, true. It's basically good for someone who's never programmed before and thinks "there's no way I could do this"...it gets someone going that way I feel...
Getting your hands dirty is definitely a good thing, but CodeAcademy is a bit dry. The best thing I've found is trying to get someone to make something that THEY want or need. For someone 100% new to programming, that can be a bit tough though. So books, classrooms and MOOCs do have their place I think.
The problem with this question is by the time I finish typing my answer, the JS world will have moved on to the next big thing
yawn try again sweetie by the time you finish typing your answer some other boring knucklehead will have typed the same answer thinking they're clever
Even if so, if you "learned Javascript" as opposed to "learned last big thing", then it will look the same to you.
Yes, React will be baked into the browser, wasm will be supported widely and everyone will write JS in their favorite language. Not to mention JS will have threads.
I've been going through the challenges and projects at freeCodeCamp to shore up my JS skills. I had been using React and started to focus on the D3.js projects. Started a new project with React and now I'm being told that React.createClass is being deprecated in v16. JS the language is getting better and more powerful. The frameworks and the libraries are a moving target.
These:

- Secrets of the JavaScript Ninja by John Resig (my favorite)

- Eloquent JavaScript by Marijn Haverbeke

This is a bit unorthodox, but I personally got a lot out of taking the LISP code in Structure and Interpretation of Computer Programs, and mentally translating the examples and solving the exercises in Javascript. There's apparently versions of the text around with the exercises pre-translated, though translating it myself was valuable to me.

Obviously, this will more teach you how to write good code that happens to be in Javascript, rather than taking an already-solid programmer and showing them the nitpicky details, idiosyncrasies, and browser APIs of Javascript.

As a supplementary resource rather than a primary learning guide, I found this site[1] to be profoundly helpful. It explains a lot of the intricacies, oddities, pitfalls and points of confusion in the language.

[1] http://bonsaiden.github.io/JavaScript-Garden

I found JavaScript: The Good Parts useful. It's very short and gets right to the point. The author focuses on the parts of the language people tend to use every day and highlights some gotchas and common mistakes that you might not expect (like == vs ===) if you're coming in from other languages.
One warning: Although it's a good book, it was published in 2008 and a lot has been added to the language since then. It will give you a solid understanding of the core of the language, but for modern best practices you'll have to look elsewhere.
Where would you suggest?
MDN.
Hello there jensvdh, pleased to make your acquaintance.
Always a pleasure to meet a fellow Jens!
Agreed, I own this book and it was great several years ago but it does not include ES5, 6 and now 2016, 2017. I think you're better off learning online. Or to get started read it and then add to the knowledge here: http://es6-features.org/#Constants (whoever set up that site is great, it's helped me out).
IMHO, this is not a good book for learning JavasScript. It's probably a good read for someone with intermediate knowledge of JavaScript looking to expand their understanding of the language. But it covers nothing about the DOM, or how to use it on a web page, which is what virtually 100% of anyone learning JavaScript will be wanting to learn it for. So, yes you can learn the language from this book, but if you actually want to do something useful with the language you'll need to move on to another source.

And, although the book is dated, I think it still does a good job of explaining the core concepts of the language even of today.

Agree. For fun, yes but for new people to learn about JavaScript, no.
I think this question needs to be expanded upon before an adequate answer can really be given.

Are you looking to learn code via JS?

Are you proficient in another language that has similar constructs to JS and just need to understand the nuances?

Are you somebody who has understood JQuery on a low level but never understood what the code was actually doing?

I am sure there are a few more questions along similar veins and I think each one of these questions could be interpreted from the OP and I think all of these have potentially different answers.

What about someone who is proficient in python, can piece together awful Javascript, has no fundamental understanding of the language structure, and is overwhelmed by all the competing frameworks and build tools.

Lately I just turn to intercooler, but that's not a solution for everything.

I honestly don't know. Maybe read one of the books mentioned here, eloquent or the good parts, and enroll in a course specific to a framework (i got a free subscription to front-end masters, that has a few good courses) and go from there.
I can code ok in basic JavaScript, mostly jQuery, but I don't really understand a lot if I'm being honest.
I think it depends on your learning style & what you want to learn. http://jsbooks.revolunet.com/ is a great resource for free books.

If you want to learn concepts, You Don't Know JS by Kyle Simpson is great.

If you want to learn by doing, I would look away from books & more towards video based learning. It seems to have richer content in this style. Pluralsight, Frontend Masters, Egghead & Code School are all great. They also target different niches. If you're a complete beginner I suggest Code School. It does the best out of those at telling you where to start & what to learn next.

learn about closures and functions.
I highly recommend Secrets of the JavaScript Ninja by John Resig. It boosted my career significantly by giving me enough low-level practical understanding to become much more productive writing JS. Highly recommended.
JavaScript and JQuery - Murach. It's a two paged book. Left side you have text and right side you have code. So it is easy to get what they are explaining. Also they have good exercises to solve and learn.
Is it strange that when I consider learning a new language, I don't turn to books? My instinct is that I can learn more quickly and interactively online. Particularly JavaScript, as the browser you are using to browse the websites teaching you JavaScript is already a full JavaScript interpreter and development suite.

No waiting for your code to be processed server side, or anything like that. I pick up a book later on, commonly, if I know the language and want to know more about techniques for building something specific with it.

I use books for libraries and large software projects. For languages I use books as references (early on, sometimes)

But for learning a new language, an editor and a hello world app are where I start.

If you need to read and understand the source code powering popular frameworks then following is the best book.

JavaScript Patterns / Build Better Applications with Coding and Design Patterns / By Stoyan Stefanov

Not a book, but I really like the format of nodeschool.io lessons.