JS Operators

JavaScript operators are used to perform operations on variables and values. They are categorized into different types based on their functionality.

1. Arithmetic Operators

Used for mathematical calculations.

OperatorDescriptionExampleOutput
+Addition5 + 38
-Subtraction10 - 46
*Multiplication6 * 212
/Division10 / 25
%Modulus (Remainder)10 % 31
**Exponentiation (ES6)2 ** 38
++Incrementlet x = 5; x++6
--Decrementlet y = 5; y--4

Example:

let a = 10, b = 3;
console.log(a + b);  // Output: 13
console.log(a % b);  // Output: 1
console.log(a ** b); // Output: 1000

2. Assignment Operators

Used to assign values to variables.

OperatorDescriptionExampleEquivalent To
=Assignx = 5x = 5
+=Add & Assignx += 3x = x + 3
-=Subtract & Assignx -= 2x = x - 2
*=Multiply & Assignx *= 4x = x * 4
/=Divide & Assignx /= 2x = x / 2
%=Modulus & Assignx %= 3x = x % 3
**=Exponent & Assignx **= 2x = x ** 2

3. Comparison Operators

Used to compare values and return true or false.

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad