JavaScript裏四捨五入函數round的用法實例
來源:文萃谷 1.84W
本文實例講述了JavaScript裏四捨五入函數round用法。分享給大家供大家參考。具體如下:
JavaScript的Math對象包含了一個round方法用於對數字進行四捨五入操作,下面的代碼詳細演示了其用法
Click the button to round the number 2.5 to its nearest integer.
Try it
function myFunction(){lementById("demo")rHTML=d(2.5);}
希望本文所述對大家的javascript程序設計有所幫助。