The best reference for JS and related technologies by far is the Mozilla Developer Network , I am constantly looking stuff up there. And here is a good cheat sheet to reference while you're getting started.
These resources are all about writing code that is less likely to have bugs through using a consistent style and avoiding practices that lead to confusing or hard to debug code. The problem is that this is all subjective material, and a giant bike shed for anyone who feels like arguing about it.
This is the content that originated here and not a set of links. It attempts to answer in detail the question "What state does my function have access to when it's invoked?" This turns out to be a complex question, leading to a lot of unexpected behavior. This section will hopefully remove a lot of surprises, allowing us to understand higher level abstractions that rely on these concepts.
These resources build on the rest of our knowledge to create expressive, reusable, easy to interact with code.