javascript - Getting unexpected behaviour with firefox web console, equality for undefined not working fine -


when trying write following javascript code snippet in mozilla web console getting following unexpected behaviour.please refer below image.when declared variable x undefined check evaluated true.but when defined "var a" seemingly wrong answer.i have checked chrome working fine.can please explain obscure behaviour?

enter image description here

there's global variable named a , has value. var a; declaration doesn't create new variable. try changing code to:

if (a === undefined) {     console.log("undefined true"); } else {     console.log("undefined false, = " + a); } 

so can see value of variable.


Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -

javascript - How to change image src on success AJAX -