JS Language

Oliver Stigley

JS Language

01 April 2016

Parentheses ()

Parentheses are used in Javascript to hold function parameters, contain control flow conditional statements and generally for BEDMAS. A function typically hss the form function(parameters) {code}. The parentheses hold the parameters, or the items that are passed to the {code}. Control flow statements including loops, if, while... also use parentheses to indicate the conditions in which the code block is used. Finally, good old fashioned bedmas needs some parentheses when you are doing arithmetic.

brackets []

Square brackets are used to call an index of an array, or a property of an object. Array[0] would call the first value of an array (using zero based indexing, and Object["property"] calls the value of the "property" in that object.

Braces {}

Curly braces are used to contain code blocks, instructions or information. The instructions are carried out when the function or statement is called that contains the curly braces. Additionally, curly braces are also used to specify Objects in Javascript, which contain 'property': 'value' pairs.

Single quotes ''

Single quotes are used to hold strings.

Double quotes ""

Double quotes are also used to hold strings.