- 相關(guān)推薦
JavaScript里四舍五入函數(shù)round的用法實例
本文實例講述了JavaScript里四舍五入函數(shù)round用法。分享給大家供大家參考。具體如下:
JavaScript的Math對象包含了一個round方法用于對數(shù)字進(jìn)行四舍五入操作,下面的代碼詳細(xì)演示了其用法
Click the button to round the number 2.5 to its nearest integer.
Try it
function myFunction(){document.getElementById("demo").innerHTML=Math.round(2.5);}
希望本文所述對大家的javascript程序設(shè)計有所幫助。
【JavaScript里四舍五入函數(shù)round的用法實例】相關(guān)文章:
javascript跨域訪問的方法07-19
excel函數(shù)07-30
all用法要點07-24
again用法詳解08-25
英語介詞to的用法匯總02-01
英語方位名詞的用法07-19
俄語動詞“體”的用法02-04