字符串和數(shù)字都可以是為什么
document.write(Math.ceil(9.9));輸出是10; document.write(Math.ceil("9.9"));輸出也是10; 不管字符串還是數(shù)字都能正常運(yùn)行,想知道為什么?
document.write(Math.ceil(9.9));輸出是10; document.write(Math.ceil("9.9"));輸出也是10; 不管字符串還是數(shù)字都能正常運(yùn)行,想知道為什么?
2016-06-15
舉報(bào)
2016-06-15
Math.ceil(9.9)直接處理輸出結(jié)果;Math.ceil("9.9")轉(zhuǎn)化成數(shù)字后在處理輸出
2016-06-15
內(nèi)部會(huì)自行轉(zhuǎn)換