Operators
Operators are used to perform operations on Operands.
There are the following types of operators in JavaScript.
Arithmetic Operators (+, -, *, /, ...)
Comparison (Relational) Operators (==, ===, >, <, ...)
Bitwise Operators (&, |, >>, << , ... )
Logical Operators (&&, ||, !)
Assignment Operators ()
Special Operators
==
It is often called Double equals or Loose equality. It checks whether its two operands are equal, returning a Boolean result. It compares operands ignoring their data types. It checks values but not data type.
If one of the operands is null or undefined, the other must also be null or undefined to return true. Otherwise, return false.
This operator checks equality only after converting both the values to a common type i.e type coercion.
const a = 123;
const b = "123";
console.log("== result " , a==b);
//output: == result true
===
It is often called Tripple equals or Strict equality. It returns false for the values which are not of a similar type. It checks values as well as data types.
It always considers operands of different types to be different.
const a = 123;
const b = "123";
console.log("=== result " , a===b);
//output: == result false
Thanx for reading my blog.
It was my first blog on hashnode and I hope you find it useful.
Thanx for giving your time.
You can connect with me on Linked In