Possible Duplicate:
Javascript === vs == : Does it matter which “equal” operator I use?
Hi,
This is my tiny code:
var domains_before_update = storage.getItem('domain_list_original');
if(domains_before_update==null || domains_before_update=="" )
{
gBrowser.selectedTab = gBrowser.addTab("chrome://filter/content/block_and_redirect_list.html");
}
Is that correct or should I be using === instead of == ?
Thanks!
===checks the strict equals (without coercion) that you’re used to , where==checks the value [after built-in coercion] equalitybut as the other answer(s) noted, strict equality does not work when checking for null, use
!variablesame as this post: Difference between == and === in JavaScript
edit: clarified some of the wording thanks to the helpful comments!