It seems that JS V8 engine has a bug.
As example you can execute this script in the Chrome console (I use version 51.0.2704.103 m.) and each time you will get random (at first glace) number of true and false values:
function foo(){
return typeof null === 'undefined';
}
for (var i = 0; i<1000; i++) console.log(foo());
For example:
On different OS / systems this bug appears on different iterations.
I realize that this question has little practical sense, but I wonder what causes this strange behavior and depending on what changes the number of iterations?
Also, what should be kept in mind when you write code using typeof null
in case of this bug?