為什么不能將Math()作為函數(shù)名?
function Math(x){
??? document.write(Math.ceil(x)+"<br/>");
??? }
Math(3.3);
Math(-0.1);
Math(-9.9);
Math(8.9);
請(qǐng)問(wèn)為什么不能將Math()作為函數(shù)名,而一定要用小寫(xiě)的math()呢?
function Math(x){
??? document.write(Math.ceil(x)+"<br/>");
??? }
Math(3.3);
Math(-0.1);
Math(-9.9);
Math(8.9);
請(qǐng)問(wèn)為什么不能將Math()作為函數(shù)名,而一定要用小寫(xiě)的math()呢?
2015-12-10
舉報(bào)
2015-12-10
Math是js內(nèi)置對(duì)象,相當(dāng)于保留字,和不能用function作為函數(shù)名一個(gè)道理