**Previous article: **JavaScript Course | Data Types in JavaScript

An operator is capable of manipulating a certain value or operand. Operators are used to perform specific mathematical and logical computations on operands. In other words, we can say that an operator operates the operands. In JavaScript operators are used for compare values, perform arithmetic operations etc. There are various operators supported by JavaScript:

- Arithmetic Operators
- Assignment Operators
- Comparison Operators
- Logical Operators
- Ternary Operators
- typeof Operator

**Arithmetic Operators:**

There are various Arithmetic Operators –

**+ (Addition) :**

‘+’ operator performs addition on two operands.

**Example :**Y = 5 + 5 gives Y = 10

**Note :**‘+’ operator can also be used to concatenate (add) strings.

**Example :**

Y = "Geeks" + "for" + "Geeks" gives Y = "GeeksforGeeks"

**Example :**Y = "Geeks" + 4 + "Geeks" gives Y = "Geeks4Geeks"

**– (Subtraction) :**

‘-‘ operator performs subtraction on two operands.

**Example :**Y = 5 - 3 gives Y = 2

*** (Multiplication) :**

‘*’ operator performs multiplication on two operands.

**Example :**Y = 5 * 5 gives Y = 25

**/ (Division) :**

‘/’ operator performs division on two operands (divide the numerator by the denominator).

**Example :**Y = 5 / 5 gives Y = 1

**% (Modulus) :**

‘%’ operator gives remainder of an**integer**division.

**Example :**A % B means remainder (A/B) Y = 5 % 4 gives Y = 1

**+ + (Increment) :**

‘+ +’ operator increases an integer value by one.

**Example :**let

**A = 10**and**Y = A + +**then A = 11, Y=10 if**A = 10**and**Y = + + A**then A = 11, Y=11**– – (Decrement) :**

‘- -‘ operator decreases an integer value by one.

**Example :**let

**A = 10**and**Y = A - -**then A = 9, Y=10 if**A = 10**and**Y = - - A**then A = 9, Y=9

**Assignment Operators : **

There are various Assignment Operators in JavaScript –

**= (Assignment Operator) :**

Assigns right operand value to left operand.

**Example :**If A = 10 and Y = A then Y = 10

**+= (Add and Assignment Operator) :**

Sums up left and right operand values and then assign the result to the left operand.

**Example :**Y += 1 gives Y = Y + 1

**– = (Subtract and Assignment Operator) :**

It subtract right side value from left side value and then assign the result to the left operand.

**Example :**Y -= 1 gives Y = Y - 1

- similarly there are
***= (Multiply and Assignment)**,**/= (Divide and Assignment)**,**%= (Modules and Assignment)**

**Example :**Y *= A is equivalent to Y = Y * A Y /= A is equivalent to Y = Y / A Y %= A is equivalent to Y = Y % A

**Comparison Operators : **

There are various Comparison Operators in JavaScript –

**= = :**

Compares the equality of two operands. If equal then the condition is true otherwise false.

**Example :**Y = 5 and X = 6 Y = = X is false.

**Note :**Type not considered in ‘= =’ operator.**= = = :**

this operator compares equality of two operands with type.If equal(type and value both) then condition is true otherwise false.

**Example :**given X = 10 then X = = = "10" is false. X = = = 10 is true.

**!= (Not Equal) :**

Compares the inequality of two operands. True if operands are not equal.

**Example :**given X = 10 then X ! = 11 is true.

**> (Greater than) :**

this operator checks whether the left side value is greater than the right side value. If yes then it returns true otherwise it returns false.

**Example :**given X = 10 then X > 11 is false.

**< (Less than) :**

this operator checks whether the left side value is less than right side value. If yes then it returns true otherwise it returns false.

**Example :**

given X = 10 then X < 11 is true.

**> = (Greater than or Equal to) :**

this operator checks whether the left side operand is greater than or equal to the right side operand. If yes then it returns true otherwise it returns false.

**Example :**given X = 10 then X > = 11 is false.

**<= (Less than or Equal to) :**

this operator checks whether the left side operand value is less than or equal to the right side operand value. If yes then it returns true otherwise it returns false.

**Example :**given X = 10 then X < = 10 is true.

**typeof Operator: **In JavaScript, the typeof operator returns the data type of its operand in the form of a string. The operand can be any object, function or variable.

**Syntax: **

typeof operand OR typeof (operand)

**Example:**

`<html> ` `<head> ` `<title> GfG ` `typeof` `example </title> ` `</head> ` `<body> ` ` ` ` ` `<script type=` `"text/javascript"` `> ` ` ` `var` `a = 17; ` ` ` `var` `b = ` `"GeeksforGeeks"` `; ` ` ` `var` `c = ` `""` `; ` ` ` `var` `d = ` `null` `; ` ` ` ` ` `document.write(` `"Type of a = "` `+ (` `typeof` `a)); ` ` ` `document.write(` `"<br>"` `); ` ` ` ` ` `document.write(` `"Type of b = "` `+ (` `typeof` `b)); ` ` ` `document.write(` `"<br>"` `); ` ` ` ` ` `document.write(` `"Type of c = "` `+ (` `typeof` `c)); ` ` ` `document.write(` `"<br>"` `); ` ` ` ` ` `document.write(` `"Type of d = "` `+ (` `typeof` `d)); ` ` ` `document.write(` `"<br>"` `); ` ` ` ` ` `document.write(` `"Type of e = "` `+ (` `typeof` `e)); ` ` ` `document.write(` `"<br>"` `); ` ` ` `</script> ` `</body> ` `</html> ` |

*chevron_right*

*filter_none*

**Output:**

Type of a = number Type of b = string Type of c = string Type of d = object Type of e = undefined

**Next article: ** JavaScript Course | Practice Quiz-1

## Recommended Posts:

- JavaScript Course | Logical Operators in JavaScript
- JavaScript Course | Understanding Code Structure in JavaScript
- Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript
- JavaScript Course | Loops in JavaScript
- JavaScript Course | Data Types in JavaScript
- JavaScript Course | Printing Hello World in JavaScript
- JavaScript Course | What is JavaScript ?
- JavaScript Course | Functions in JavaScript
- JavaScript Course | Variables in JavaScript
- JavaScript Course | Conditional Operator in JavaScript
- JavaScript Course | Objects in JavaScript
- JavaScript Course | JavaScript Prompt Example
- JavaScript Course | Interaction With User
- JavaScript Course | Task Tracker Project
- HTML Course - Starting the Project | Creating Directories
- HTML Course | Structure of an HTML Document
- HTML Course | First Web Page | Printing Hello World
- HTML Course | Basics of HTML
- HTML Course | Understanding and Building Project Structure
- HTML Course | Building Header of the Website

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.