10 Tips for JavaScript Beginners

This JavaScript 101 post is based on the presentation JavaScript Syntax by Ynon Perek.

Puzzle pieces By liza31337

Puzzle pieces By liza31337

Ynon‘s slides do a great job covering key JavaScript fundamentals:

Values
1. Undefined refers to anything that hasn’t been assigned a value.
2. In JS, false is made up of false, null, unidentified, “”, 0, and NaN.
3. Everything else is truthy in JS.

Naming Conventions
4. Identifiers start with letters, _, or $. They are followed by letters, digits, _, or $.
5. Variable names are lowercased, with words split by _. Function names are CamelCased.

Variables
6. JavaScript has function scope.
7. Outside of functions, any variables defined have global scope and is accessible anywhere in the application.

Objects
8. Objects are a collection of key, value pairs.
9. Functions are normal JS objects.
10. function foo() {} is equivalent to var foo = function() {};

JavaScript and JQuery are powerful tools for implementing web page user interaction. The best way to get started is to try writing some JavaScript and look up anything that you’re not sure about.