Skip to main content

Command Palette

Search for a command to run...

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

== vs ===

Published
โ€ข1 min readโ€ขView as Markdown
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