for循环写向上取整数组
var a=[3.3,-0.1,-9.9,9.8];
document.write(a[0]+"向上取整的值为:"+Math.ceil(a[0])+"
");
for(var i=0;i<=a.length;1++)
{
document.write(a[i]+"向上取整的值为:"+Math.ceil(a[i])+"
")
}
运行结果是
3.3向上取整的值为:4
for里面我没写错吧为啥不能用for写,真的跟ceil() 括号里边必须是数值???但是i带进去啊a[i]和Math.ceil(a[i])应该是数值啊, 求大神帮解答