When trying to write the following JavaScript code snippet in the Firefox web console then I get the following unexpected behaviour. Please refer to the below image.

When I declared a variable x then the undefined check evaluated to true. But when I defined it as "var a" then I get a seemingly wrong answer. I have checked it for Google Chrome, and it is working fine. What is the explanation for this obscure behaviour?

[![Enter image description here](https://i.stack.imgur.com/S56rn.png)](https://i.stack.imgur.com/S56rn.png)