亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

怎么回事?

怎么回事,為什么沒有結果 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
提交
取消
JavaScript進階篇
  • 參與學習       468832    人
  • 解答問題       22582    個

本課程從如何插入JS代碼開始,帶您進入網頁動態交互世界

進入課程

怎么回事?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號