Home JavaScript JavaScript Operators

JavaScript Operators

Beginner ⏱ 7 min read Updated: Jul 2026
  • JavaScript operators are symbols used to perform operations on values and variables
  • Operators are used for calculations, comparisons, assigning values, and logical decisions
  • JavaScript provides different types of operators for different tasks
  • Common operators include arithmetic, assignment, comparison, and logical operators

What are JavaScript Operators?

JavaScript operators are special symbols or keywords that perform operations on one or more values. They help developers perform calculations, compare values, assign data, and control program logic.

For example, the + operator is used to add numbers, while the == operator is used to compare two values.

Types of JavaScript Operators

JavaScript provides different types of operators. The main types are:

Arithmetic Operators

Used to perform mathematical calculations.

Assignment Operators

Used to assign values to variables.

Comparison Operators

Used to compare two values.

Logical Operators

Used to combine multiple conditions.

1. JavaScript Arithmetic Operators

Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, and division.

Example

let a = 10;
let b = 5;
console.log (a+ b);
console.log (a - b); 
console.log (a * b); 
console.log (a / b);
        
Result
15
5
50
2

Arithmetic Operators List

Operator Description Example
+ Addition a + b
- Subtraction a - b
* Multiplication a * b
/ Division a / b
% Modulus a % b

2. JavaScript Assignment Operators

Assignment operators are used to assign values to variables. The equal sign (=) is the most common assignment operator.

Example

let x = 10;
 x += 5;
console.log(x);
        
Result
15

3. JavaScript Comparison Operators

Comparison operators compare two values and return a boolean result: true or false.

Example

let age = 18;
console.log(age >= 18);
        
Result
true

4. JavaScript Logical Operators

Logical operators are used to combine multiple conditions.

Example

let age = 20;
if(age > 18 && age < 30) {
console.log("Eligible");
}
        

Why Use JavaScript Operators?

Benefits: Operators help perform calculations, make decisions, compare data, and create powerful JavaScript programs.
💡 Note: Understanding operators is important because they are used in almost every JavaScript program.