I suggest you start by reading A re-introduction to JavaScript (JS Tutorial) - JavaScript | MDN which is a good start and introduction by Mozilla.

Mozilla also provide a good reference at JavaScript | MDN which I have found very helpful.

Another good place to look stuff up and learn is JavaScript Tutorial.

A helpful explanation of var and let is available at Why You Shouldn’t Use ‘var’ Anymore.

If you are writing a lot of JavaScript then consider using something like Use JSDoc to generate documentation.