为了账号安全,请及时绑定邮箱和手机立即绑定

怎么回事?

怎么回事,为什么没有结果 document.write(Math.round(3.3)+"
");  document.write(Math.round(-0.1))+"
");  document.write(Math.round(-9.9))+"
");  document.write(Math.round(8.9));

正在回答

代码语言

3 回答

document.write(Math.round(3.3)+"");  

document.write(Math.round(-0.1))+"");  //这行 -0.1后面多了一个右半边括号

 document.write(Math.round(-9.9))+"");   //这行 -9.9后面多了一个右半边括号

document.write(Math.round(8.9));


0 回复 有任何疑惑可以回复我~
var num=[3.3,-3.3,0.1,-0.1,5.5,-5.5,-5.52];
  for(var i=0;i<num.length;i++){
      document.write(Math.round(num[i])+"<br/>");
      }

这样就不用写那么多输出了

0 回复 有任何疑惑可以回复我~

代码注意规范,最好一句一行,多了两个括号。。。

以下只正确代码   


   document.write(Math.round(3.3)+" ");  

    document.write(Math.round(-0.1)+" ");  

    document.write(Math.round(-9.9)+" ");  

    document.write(Math.round(8.9));


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

怎么回事?

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号