Mathematical symbol that can act on two values (or variables) and produce a result
JavaScript adheres to the PEDMAS approach when determining the order of operations
Description | Operator | Example |
---|---|---|
Addition | + | 7 + 8 |
Subtraction | - | 34 - 12 |
Multiplication | * | 3 * 5 |
Division | / | 42 / 6 |
Modulus (Remainder) | % | 13 % 6 (returns 1, as 6 goes into 13 twice, leaving 1 as the remainder ) |
Exponential | ** | 4 ** 2 (returns 16 or 4 * 4) |
Increment | ++ | 9++ (returns 10) |
Decrement | -- |
37-- (returns 36) |
Add the following expressions in the jsbin below and evaluate the result; use console.log()
to print the result. Don’t forget to press “run” after adding your code.
45 % 3
8 / 2 * (2 * 2)
8**3