JavaScript Comparison Operators
Comparison operators are mainly used to perform the logical operations that determine the equality or difference between the values.
Name |
Description |
Syntax |
Example |
Compares the equality of two operands. If equal then the condition is true otherwise false. |
Y = 5 and X = 6 Y = = X is false. |
||
Compares the equality of two operands with type. If both value and type are equal then the condition is true otherwise false. |
Y = 5 and X = ‘5’ Y = = = X is false. |
||
Compares inequality of two operands. True if operands are not equal. |
let X = 10 then X ! = 11 is true. |
||
Compares the inequality of two operands with type. If both value and type are equal then the condition is true otherwise false. |
let X = 10 then X ! == ’10’ is true. |
||
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. |
let X = 10 then X > 11 is false. |
||
This operator checks whether the left side value is less than the right side value. If yes then it returns true otherwise it returns false. |
let X = 10 then X < 11 is true. |
||
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. |
let X = 10 then X > = 11 is false. |
||
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. |
let X = 10 then X < = 10 is true. |
JavaScript Operators
JavaScript operators are symbols used to perform specific mathematical, comparison, assignment, and logical computations on operands. They are fundamental elements in JavaScript programming, allowing developers to manipulate data and control program flow efficiently. Understanding the different types of operators and how they work is important for writing effective and optimized JavaScript code.
JavaScript Operators: There are various operators supported by JavaScript.
Table of Content
- JavaScript Arithmetic Operators
- JavaScript Assignment Operators
- JavaScript Comparison Operators
- JavaScript Logical Operators
- JavaScript Bitwise Operators
- JavaScript Ternary Operators
- JavaScript Comma Operators
- JavaScript Unary Operators
- JavaScript Relational Operators
- JavaScript BigInt Operators
- JavaScript String Operators