In JavaScript, is there a performance difference between using a double equals (==) vs using a triple equals (===)?
Example: if (foo == bar) vs if (foo === bar)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Strict comparison (
===) will always be slightly faster, but the difference is usually negligible.It definitely makes sense to prefer
===if you know for certain that you don’t need type coercion in the comparison. It will always be at least as fast as==.