Difference between == vs === in JavaScript

Hello, == and === operator difference very confusing. today I am explaining you difference between == vs === in javascript. we can use both operator for comparison.

==(Double Equals Operator)=== (Triple Equals Operator)
It will used when compare variables or values.
It will also used when compare variables/values.
It is use when we are unsure about the data type of variable/values.It is use when you sure about the data type of variable/values and want to strict comparison.

(==) do not check the data type of variable/value while making comparison.(===) check the data type of a variable while making comparison.
’25’ == 25 it will return true because double equals don’t check the data type.’25’ === 25 it will return false because triple equals compare the data type too.
250 == “250” // true250 === “250” // false
50 == 50 // true
50 === 50 // true

Leave a Reply

Your email address will not be published. Required fields are marked *

− 1 = 3