Showing posts with label JavaScript Operators. Show all posts
Showing posts with label JavaScript Operators. Show all posts

Tuesday, December 6, 2016

JavaScript Operator === vs == - Q&A

Question:

What is the difference between the '==' operator to '===' ?

Answer


While the '==' operator compare value only (if needed, making some type conversion on the way) the '===' operator compare both type and value .

JavaScript Operators - Q&A

Question:What will be the result of running the code below?
What will be the result if we'll drop the "b &&" from the if statement?

AnswerIn the first run the code will result in an exception stating that b is undefined.
In the second run the code will result in an alert("false"). This is because the property proA is undefined.