Pregunta de entrevista de ByteDance

Can you explain the difference between == and === in JavaScript?

Respuesta de la entrevista

Anónimo

20 de nov de 2024

== : Evaluating if a variable equals another by comparing only using their values. Example: "1" == 1 // true === : Evaluating if a variable is equal to another by comparing their values and data types. Example: "1" === 1 // false