SiteMap  | About    

Javascript '=' Vs. '==' Vs. '==='

= operator

The '=' is an assignment operator . An assignment operator assigns a value to its left operand based on the value of its right operand. The first operand must be a variable which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x.


The = operator behaves like other operators, so expressions that contain it have a value. This means that you can chain assignment operators as follows: x = y = z = 0 . In this case x, y, and z equal zero.

== operator

The '==' operator comparing two variables or variable to a value . It converts the operands if they are not of the same type, then applies strict comparison. If both operands are objects, then JavaScript compares internal references which are equal when operands refer to the same object in memory.


=== Operator

The "===" is an identity operator returns true if the operands are strictly equal (see above) with no type conversion. It will return false even when their values are equal but they are not of same data type.

For ex: 999 and '999', according to the values are same but they are not of same data type, hence === will return false.

example (C) 2018    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.