Pergunta de entrevista da empresa O'Reilly Auto Parts

In JavaScript what is the difference between == and ===

Respostas da entrevista

Sigiloso

11 de jan. de 2016

truthy vs equality

Sigiloso

22 de jan. de 2016

This is why we get very poor developers. The software engineers are full-time Java developers, and always part time JavaScript developers. Instead of hiring for JavaScript experts, they prefer to get a bad version of "full stack". The "==" causes the types to be converter to see if they are equal. Depending on how many times the task is executed this can be rigorous and unnecessary. The "===" is a direct comparison and assumes that both items are the same type and checks to see if they are equal. No conversion is formed so it is a lot faster. If you know you are comparing two numbers you would use (5 === 5) would be true. If you don't know what you're getting back you could use (5 == "five") which will force a conversion.