Skip to main content

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

== vs ===

Published 1 min readMarkdown
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

No comments yet. Be the first to comment.