The triple equals operator or strict equality comparison operator (===) returns a 'true' if and only if users place the same type of operands on both sides of the operator that contains the same value. For comparison, if users place different types of operands for equality, it will return the result as 'false.'
- Addition Assignment (+=)
- Subtraction Assignment (-=)
- Multiplication Assignment (*=)
- Division Assignment (/=)
- Remainder Assignment (%=)
- Left Shift Assignment (<<=)
- Right Shift Assignment (>>=)
- Bitwise AND Assignment (&=)
- Bitwise OR Assignment (|=)
- Bitwise XOR Assignment (^=)
var x = 10 console.log(x)
If users need to check if two values are unequal, first, they put an exclamation (!) mark at the beginning of the equal (=) sign (!=). Therefore, the "!=" and "!==" allows users to check whether the two assigned values are equal or not.
In more simple terms, the main difference between the Assignment operator "=," Loose Equality operator "==" and Strict Equality operator "===" operators is that the Assignment operator assigns values to a variable.
The "==" operator compares two values by making type corrections. For example, if users compare any number as a string and a numeric literal, the Loose Equality operator allows that, whereas; the Strict Equality operator does not because the Strict Equality operator checks both the value and the type of the variables.
If "===" founds the two variables having the same data type, then it returns a "true," and if the two variables are not of the same type, "===" returns false.
|Working||The = operator only assigns values to a variable.||The == operator compares two equal values without checking the type and returns true if the values are equal, else false.||
The === operator checks both the type and the values and returns true if both are the same, else false.
|Name||The Single equal (=) is known as the Assignment operator||The Double equal (==) is known as the Loose Equality operator||The Triple equal (===) is known as the Strict Equality operator|
|Syntax||The syntax of Single equal (=) is "x = y."||The syntax of Double equal (==) is "x == y."||The syntax of Triple equal (===) is "x === y."|
|Comparison||There is no need for type conversion for the Assignment operator.||The == operator performs type conversion when it founds the values are of different data types. It converts the data type of one operand to make it the same as the other.||The === operator does not perform type conversion if it finds both the operands have different data types.|
|Algorithm||The = operator does not compare values, so it involves no algorithm.||The == operator follows the abstract equality comparison algorithm.||The === operator follows a strict equality comparison algorithm.|