Skip to main content

Arithmetic Operators

Arithmetic operators are used to perform arithmetic on numbers.

The following table describes each of the operators.

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division
@Modulus (Division Remainder)

Specifications: ECMAScript Language Specifications

The type of the two operands determines the behavior of the operator. The addition operator will always return a string if one of the two operands is a string; all other operators will return a number if both operands can be converted to a number, or to Undefined if the operands do not support the operator.

Examples

10 / 2

The result will be the number 5.

10 / '2'

The result will be he number 5.

10 + 'a'

The result will be string 10a.

'10' + '2'

The result will be string 102.

10 / 'a'

The result will be Undefined. :::