Types of operators in JavaScript

 How many types of operators are there in JavaScript?

Last updated:7/19/2021 5:24:16 AM

1 Answers

Ethan Karla
Ethan Karla

JavaScript operators are symbols that are used to perform operations on operands. For example:

var sum=10+20;

Here, + is the arithmetic operator and = is the assignment operator.

There are following types of operators in JavaScript.

  1. Arithmetic Operators
  2. Comparison Operators
  3. Logical Operators
  4. Assignment Operators
  5. Conditional Operators

Arithmetic Operators

Arithmetic operators are used to perform mathematical operations between numeric operands.

Comparison Operators

JavaScript language includes operators that compare two operands and return Boolean value true or false.

Logical Operators

Logical operators are used to combine two or more conditions. JavaScript includes following logical operators.

Assignment Operators

JavaScript includes assignment operators to assign values to variables with less key strokes.

Ternary Operator

JavaScript includes special operator called ternary operator :? that assigns a value to a variable based on some condition. This is like short form of if-else condition.


Answer