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

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -