Fandom

JavaScript Wiki

Basic operators

87pages on
this wiki
Add New Page
Talk0 Share


()Edit

Parentheses (or "round brackets") explicitly set the limits of an expression and thereby clarify operator precedence.

x = 5 * (3 + 7);

x is 50.

x = 5 * 3 + 7;

x is 22.

They have a special use related to functions.

{}Edit

Braces (or "curly brackets") form a block. If treated as an expression, they become an object literal instead. Also, the block is a mandatory part of each function literal.

[]Edit

Square brackets are used exclusively with arrays.

;Edit

The semicolon tells the parser that the previous statement is finished. In most cases, it is unnecessary; see control structures.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.