Using Operators
Learn about JavaScript operators used to perform operations on variables and values.
We'll cover the following...
We'll cover the following...
Operators are fundamental to performing actions on data in JavaScript. We use them to manipulate values, combine expressions, or perform arithmetic.
Arithmetic operators
Arithmetic operators perform mathematical calculations. These are as follows:
Operator | Description |
| Addition |
| Subtraction |
| Multiplication |
| Division |
| Modulus (Remainder) |
| Exponentiation |
Consider the following examples of using arithmetic operators in code:
In the above code:
Line 1: Variables
aandbare initialized.Line 2: The
+operator addsaandb.Line 3: The
-operator subtractsbfroma.Line ...