User Himal say use typeof.. so I can found the answer
var myvar=5
alert(typeof myvar);
//alerts "number"
so to know kind of varible use typeof
source : http://www.javascriptkit.com/javatutors/determinevar2.shtml
题
How to identify kind of varible, I'm trying to compare in JavaScript? I just have always the same problems in JavaScript with the kind of varibles, like
so many times i have to use
the problem is when I use to compare [(value==true)], when the variable is not boolean or when I try to compare with others values [(value==varible)]
so there is a way to know what kind of variable is? a way to know the type of value
解决方案
User Himal say use typeof.. so I can found the answer
var myvar=5
alert(typeof myvar);
//alerts "number"
so to know kind of varible use typeof
source : http://www.javascriptkit.com/javatutors/determinevar2.shtml