what is difference between == and === in Javascript ?

== vs ===

ยท

1 min read

what is difference between == and === in Javascript ?

Hi Friend ๐Ÿ˜Ž

Do you know, what is difference between "==" and "===" in Javascript ?

"==" is known as loosely equal.

It performs type cohesion.

It checks two values and returns true even if they are not of equal types but equal values.

Example : 
"6" == 6 returns true
6 == 6 returns true

ย 

ย 

"===" is known as strictly equal.

This does not perform type cohesion.

It checks two values and returns true only if they are of equal type and equal value.

Example :
6 === 6 returns true 
"6" === 6 returns false
ย