How To Do Math in JavaScript with Operators

Mathematical operations are among the most fundamental and universal features of any programming language. In JavaScript, numbers are used frequently for common tasks such as finding browser window size dimensions, getting the final price of a monetary transaction, and calculating the distance between elements in a website document.

Arithmetic Operators

Arithmetic operators are symbols that indicate a mathematical operation and return a value. In the equation 3 + 7 = 10, the + is the syntax that stands for addition.

JavaScript has many familiar operators from basic math, as well as a few additional operators specific to programming.