Yep, that's my face

Troy Lamerton

Punctuating in the Javascript language

25 April 2016

Every programming language has a bunch of different grouping characters to tell the computer how to treat a group of code.

Here are some of the grouping characters used in Javascript and all their possible uses.

Parentheses ( )
Parentheses are used before a function's body to take in parameters and before a loop or if statement to determine whether the code will run.

Brackets [ ]
Brackets are often used to store and retrieve items from lists (arrays).

Braces { }
Braces enclose blocks of code to be run for functions, loops and if statements. They also group object literals.

'Single' and "doubles" quotes
A pair of single quotes 'content here' and double quotes "content here" can be used interchangeably with Javascript not noticing the difference. A nifty trick is that the two types of quoting can be combined to do things like have HTML double quotes within Javascript's 'single quotes'.