Types of JavaScript Operators
There are different types of JavaScript operators:
- Arithmetic Operators
- Assignment Operators
- Comparison Operators
- Logical Operators
- Conditional Operators
- Type Operators
Operation Table
Line | Operation | Description |
---|---|---|
1 | + | Addition |
2 | - | Subtraction |
3 | * | Multiplication |
4 | ** | Exponentiation (ES2016) |
5 | / | Division |
6 | % | Modulus (Division Remainder) |
7 | ++ | Increment |
8 | -- | Decrement |
Line | Operator | Example | Same As |
---|---|---|---|
1 | = | x = y | x = y |
2 | + | x += y | x = x + y |
3 | - | x -= y | x = x - y |
4 | * | x *= y | x = x * y |
5 | / | x /= y | x = x / y |
6 | % | x %= y | x = x % y |
7 | ** | x **= y | x = x ** y |
Sample1: (+)
JavaScript/006-MathematicalOperations/001
Sample2: (-)
JavaScript/006-MathematicalOperations/002
Sample3: Make Tax Payment
JavaScript/006-MathematicalOperations/003
Sample4: String and numbers
JavaScript/006-MathematicalOperations/004
Sample5: String and numbers
JavaScript/006-MathematicalOperations/005
Sample6: BigInt
JavaScript/006-MathematicalOperations/006