JavaScript Operator Precedence

Operator precedence describes the order in which operations are performed in an arithmetic expression.

Multiplication (*) and division (/) have higher precedence than addition (+) and subtraction (-).

As in traditional mathematics, multiplication is done first:

let x = 100 + 50 * 3;

When using parentheses, operations inside the parentheses are computed first :

let x = (100 + 50) * 3;

Operations with the same precedence (like * and /) are computed from left to right : Continue reading JavaScript Operator Precedence

JavaScript Arithmetic

JavaScript Arithmetic Operators

Arithmetic operators perform arithmetic on numbers (literals or variables).

Operator Description
+ Addition
Subtraction
* Multiplication
** Exponentiation (ES2016)
/ Division
% Modulus (Remainder)
++ Increment
Decrement

Continue reading JavaScript Arithmetic