Different between == and === in javascript

Publié le: 28 février 2024
sur la chaîne: Tech Tutor Pro
110
7

The == operator checks for equality of values after converting the operands to the same type. This process is called type coercion. For example, 1 == '1' would return true because JavaScript coerces the string '1' to the number 1 before comparison.

On the other hand, the === operator, known as the strict equality operator, not only checks for equality of values but also ensures that the operands are of the same type. It does not perform type coercion. So, 1 === '1' would return false because they are of different types.

In essence, == is more lenient as it allows type coercion, while === is strict and requires both value and type to be the same for equality.


------------------Social link----------------

Twitter:
  / techtutorpro  

Facebook:
  / techtutorpro  


Contact us:Raselj44@gmail.com


Sur cette page du site, vous pouvez voir la vidéo en ligne Different between == and === in javascript durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Tech Tutor Pro 28 février 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 110 fois et il a aimé 7 téléspectateurs. Bon visionnage!