I just test the “typeof” in javascript, and really don’t know why the result is like this.
/****/
var cota,
plouto;
alert(typeof plouto/cota); //NaN
/****/
var cota,
plouto;
alert(typeof (plouto/cota)); //number
/****/
var cota,
plouto;
var flo = plouto/cota;
alert(typeof flo); //number
The first one alerts
NaNbecause thetypeof ploutois executed first, and the result is divided bycota. The result of that is not a number, henceNaN. You could imagine it like this:(typeof plouto) / cotaThe second one divides
ploutobycota, which is not a number (because both variables areundefined), but the type ofNaNis actuallyNumber, which can be confusing!The same goes for the third example.