operators

What is operator in js ?

  • Profile picture of Mcs
  • by Mcs June 30, 2025

In JavaScript, an operator is a special symbol or keyword that performs an operation on one or more values, called operands. Operators are fundamental to building expressions and manipulating data within JavaScript programs.

Types of Operators in JavaScript

JavaScript provides many types of operators used to perform operations on variables and values.

1. Arithmetic Operators

Used for mathematical calculations.

 

Arithmetic Operators

2. Assignment Operators

Assign values to variables.

 Assignment Operators

 3. Comparison Operators

Compare two values (returns true or false).

Comparison Operators

4. Logical Operators

Used with Boolean values.

Logical Operators

 5. String Operator

Used to combine (concatenate) strings.

let a = "Hello";
let b = "World";
let c = a + " " + b;  // "Hello World"

6. Type Operator

Check the type of a variable.

Type Operator

7. Bitwise Operators

Works on binary numbers (rarely used in basic JS).

example

let result = age >= 18 ? "Adult" : "Minor";

Bitwise Operators

8. Ternary Operator

Shortcut for if...else.

Comments

Add new comment

Restricted HTML

  • Allowed HTML tags: <br> <p> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <cite> <dl> <dt> <dd> <a hreflang href> <blockquote cite> <ul type> <ol type start> <strong> <em> <code> <li>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.