I’m going to assume that you know the absolute basics and is familiar with the language constructs.
- Function declarations occur as standalone constructs and cannot be nested within non-function blocks.
- Avoid falling into the trap of mismatched quotes, parentheses and brackets. Always code the opening & closing element at the same time.
- If you have a bunch of parenthesis, count the opening parenthesis and then the closing parenthesis, and make ensure the two numbers are equal.
- JS Variables that are not declared with the var keyword are global.
- When you declare a JS function more than once, the last declaration of that function will overwrite all previous version of that function.
- Null is for an object, undefined is for a property, method or variable. To be null, your object has to be defined.
- If your object is not defined, and you test to see whether it’s null, since it’s not defined, it can’t test, and will throw an error.
- A function declared with a variable assignment syntax can only be used by code that executes after the assignment statement that declares the function.