Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Best current book to learn JavaScript?
183 points by babyboy808 on June 1, 2017 | hide | past | favorite | 93 comments

And anti-answer: consider learning JavaScript from something other than a book. The publication cycle for conventional box is relatively long, relative to the pace of technology evolution.

By the time the author writes it, it's published, and you read it, the information can be dated, sometimes extremely so.

There are gobs of online resources, and the best resource is rarely mentioned: reading other peoples code.

Once you get a basic understanding, you can start right clicking on webpages, "inspect source", opening the console window, and looking at how pages actually work. The debugger and single stepping chrome are quite good.

Agree with most of your answer but your last point is pretty optimistic. Nowadays most Javascript is a bundled package of 100 minified npm modules.

Also there are many books online which don't need to go through the hoops you describe.

If you visit a website owned by a company you're probably right. If you visit a little demo (like the type of thing someone would hack up in a day and put up on show HN) you'd be surprised by how much investigation you can do.

I agree that there are many books online though, and they can provide a lot of nice things like running code samples in your browser. However, I find video tutorials to provide a better experience than books, online or not. I suppose that's just a matter of personal preference though.

That's a problem specific to the Node.js NPM ecosystem.

However Javascript (in its current ES7 version) is a pretty good language.

All excellent points payne92. More than that,JavaScript study for a front-end developer(for example) demand MongoDB. Or you must know elementary programming in any language first off.

I generally agree with this. When it comes to languages and implementations it's often better to just learn by doing/hopping around little blogs and documentation here and there. As you said, technology evolves too quickly for authors to keep up.

That being said, there are some pretty fundamental abstract concepts behind all forms of programming that have stuck around for a long time: those old comp sci course materials. I'd recommend turning to books for some of that content, as picking up some knowledge there will support you no matter what programming language you try to learn.

Not to be snarky, but JS has more bad examples of these concepts than one can count....

Having said that it is a good idea to learn about these early and keep them in mind. Sadly there isn't a good definitive list of JS' idiosyncrasy that I know of.

This is so true! Especially the part about reading other people's code. It seems boring and tedious, but it becomes eye-opening and really helps improve the quality of the code you write as well

Which ones would you propose as "good-to-be-read" js projects?

I'd recommend reading the source of things you're working with (or want to work with) first.

If you're doing front-end work, then React and Redux (or Angular, or jQuery, or whatever.)

If you're doing Node.js, try reading through the lib/ folder of Node's source (the js code goes in lib/, the c++ goes in src/), and follow that with packages like express and request.

When you hit an interesting/confusing/etc. dependency, track it down and read it's source too.

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.

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.

To get comfortable with recursion, you should check out a simple functional language like Scheme (https://mitpress.mit.edu/sicp/full-text/book/book.html)

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.

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.


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.

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.

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.

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.

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).

Where would you suggest?


Hello there jensvdh, pleased to make your acquaintance.

Always a pleasure to meet a fellow Jens!

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.

everything by Reg “raganwald” Braithwaite is fantastic

I've never seen anyone use a POJO like this guy

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

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.

Secrets of the JavaScript Ninja, Second Edition along with You Don't Know JS are always my two recommendations. The two together shore up the weaknesses in the other.

Ninja is the best mid-level book period. Little heavy to starr out with, I think.

Maybe check out Practical Modern JavaScript, which I wrote, which is free


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.

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!)

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.


I liked Zakas' books, the older one http://a.co/4e5JLrI for the breadth and history and the concise update: http://a.co/2U97acq

Would also recommend "Principles of Object Oriented JavaScript" by him: https://www.amazon.com/Principles-Object-Oriented-JavaScript...


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

- Eloquent JavaScript by Marijn Haverbeke

http://javascript.info starts out simple enough for complete beginners but goes deep enough that even intermediate users can find new details.

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.

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.

"Eloquent Javascript" (http://eloquentjavascript.net/) definitely gets my vote, as it starts with concepts that someone new to programming would need to understand before diving into the specifics of the language. Available to read online for free, although well worth spending money on a physical copy to thumb through, but it may be a little too slow to get going for someone who already has experience with other languages.

For developers, I'd recommend Kyle Simpson's "You Don't Know JS" books, in particular "This & Object Prototypes", followed by "Scopes & Closures". Well written, with plenty of example code, these are deep dives into specific areas which make Javascript different/weird. They're available to read in his Github repo (https://github.com/getify/You-Dont-Know-JS), but consider buying them, as he deserves to get paid.

Having conducted over 100 interviews for JS positions, here is my advice.

- You have to start with ECMA5. 95% of new features in later versions can be transpiled back to it, and examining resulting code is usually the easiest way to comprehend them. Oh, how many candidates I've seen that talk about 'modern classes' with a flare and then can't explain prototypical inheritance at all. So, the best start is "JavaScript: The Definitive Guide, 6th Edition".

- Be very careful about what you read online. Blog platforms are full of script kiddies trying to feed you their misconceptions without a second thought. I generally only 'trust' two sources - Mozilla Developer Network and http://2ality.com/ by Axel Rauschmayer (I believe his books are mentioned in other answers too).

- Whenever you are faced with a particular library/technology - look from books/posts from their creators or someone associated with them.

FWIW, I started with Eloquent Javascript and moved on to You Don't Know JS. For me (self-taught type but with some experience, mostly use Python and Clojure) that seemed to do the trick, I'm working on a small Vue.js learning-type project right now and it isn't horribly blowing up, I feel lots more comfortable than I used to with JS, etc.

My advice is, first make sure you are going to learn the latest version of javascript, which is "Ecmascript2016" alias ES7 alias ES2016. ES2015 (alias ES6) is also fine.

Previous versions of Javascript make JS a mediocre language, while ES2016 makes it a pretty good and powerful one. So try to look for a tutorial that is very recent and focused on the latest javascript idioms.

I think that if you already know how to program in at least one of the following languages: C++/C#/Java/Python, you will learn Javascript in no time, no need for a book, to be honest.

Javascript is a very simple language, my recommendation would be to start as follows: 1. First learn how to create a JSON (javascript object notation) object 2. Then understand how to define a function (better if you do it the ES6 way, that is, using the "=>" operator), and how to call it. 3. Learn how to use lists and hashtables(dictionaries). 4. After this, learn how to use JSON objects, that is, how to access each member of a JSON object. This will be trivial after step (3). 5. Then, learn the simple logic constructs: if, for, etc. They are easy, really.

Now comes the slightly more difficult part. I'm assuming you want to try Node.js development.

6. Learn what is the Node.js "event loop". IN other words, the philosophy behind Node and why most operations are "asynchronous" in Node.js. Learn about callbacks. 7. Now learn about "Promises" and learn how to use "async" and "await" to consume Promises easily. In other words, to program using asynchronous functions with no sweat. 8. Learn "express.js" web framework. It is really easy.

And don't forget to take a look to the ES6 and ES7 features and make sure you take advantage of them:

ES6 http://es6-features.org

ES7 https://h3manth.com/new/blog/2015/es7-features/

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.

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.

This page is a good start if you would like to learn modern JavaScript and a framework at the same time: http://yoember.com

As a webdev who used JS for a while without really knowing what was going on under the hood and just chalking "unexpected" behavior up to That Darn JavaScript(TM), reading You Don't Know JS: Scope & Closures was really great:


If you are a beginner and looking for an engaging way to learn how to code using JavaScript, I would suggest Coding for Visual Learners (http://www.codingforvisuallearners.com). It makes no assumptions on prior programming knowledge and teaches you the basics of coding using Javascript and p5.js in a very accessible manner.

Disclaimer: I am the author of the book

I've only read parts, but Dr. Axel Rauschmayer has a few good books; Speaking JavaScript, Exploring ES2016, and more available free online here: http://exploringjs.com/. He also has an insightful blog here: http://2ality.com/

Yet another option, if you are experienced with other languages and want to learn JS: Javascript Enlightenment [1].

It only focuses on the concepts that make Javascript different from (let's say) Java.

Note: this is a pre-ES6 book.

[1]: http://www.javascriptenlightenment.com/JavaScript_Enlightenm...

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

You don't know JS goes quite in depth into a variety of areas. Worth reading further down the road. https://github.com/getify/You-Dont-Know-JS

Learning Javascript 3rd Edition by Ethan Browne published by O'Reilly - is one of the few books for learning Javascript that have been published recently - that start you off with ES6. I have found it very useful. Highly recommended.

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

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.

Do learn JavaScript the hard way on Zed's website. Once you know syntax read addy osmanis book on design patterns; Google engineer gives great examples.

Also; JavaScript the good parts

Exploring JS: JavaScript books for programmers ( free to read online )

* Speaking JavaScript

* Exploring ES6

* Exploring ES2016 and ES2017


What about http://exploringjs.com books? Somebody can comment about?

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

learn about closures and functions.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact