Operators

M2-R5.1 · Chapter 6: JavaScript and Angular JS · 2 min read

Operators in JavaScript

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

There are following types of operators in JavaScript.

  1. Arithmetic Operators
  2. Comparison (Relational) Operator
  3. Logical Operators
  4. Assignment Operators
  5. Bitwise Operators

1.Arithmetic Operators

Arithmetic operators are used to perform arithmetic operations on the operands.

The following operators are known as JavaScript arithmetic operators.

2.Comparison Operators

The JavaScript comparison operator compares the two operands. The result of Comparison operators is  always a boolean value.

The comparison operators are as follows:

3.Logical Operators

JavaScript utilizes logical operators to perform operations with boolean values or to evaluate expressions and return a boolean result.

Logical operators can be used to modify the results of comparisons.

4.Assignment Operators

JavaScript assignment operators assign a value to a variable. 

The most fundamental is the simple assignment operator (=), which takes the value of the right-hand operand and assigns it to the left-hand operand.

5.Bitwise Operators

Note –

  • Formula for left shift – number *2^n
  • Formula for Right shift – number / 2^n

Example