if判斷問(wèn)題
var x = parseInt(prompt("輸入第一個(gè)數(shù)字"));?alert(typeof x); if(x == Number) ?
?提個(gè)問(wèn)題 ? typeof x明明是 number ? 我用if判斷的時(shí)候 為false 為什么呢
var x = parseInt(prompt("輸入第一個(gè)數(shù)字"));?alert(typeof x); if(x == Number) ?
?提個(gè)問(wèn)題 ? typeof x明明是 number ? 我用if判斷的時(shí)候 為false 為什么呢
2017-04-04
舉報(bào)
2017-04-04
var x = parseInt(prompt("輸入第一個(gè)數(shù)字"));
alert(typeof x);
if(x){
?? ?alert("ok");
}
else{
?? ?alert("false");
}
你試試這個(gè)
2017-04-04
typeof x是number,x又不是 number,怎么可能true呢,改成if(typeof x == 'number')