JavaScript中的Math

//math()
//Pl
document.write(Math.PI+'<br>');
var math=10.1;
var math1=10.9;
//四捨五入round()
document.write(Math.round(math)+'<br>');
//進一法  ceil
document.write(Math.ceil(math)+"<br>");
//退一法  floor
document.write(Math.floor(math)+"<br>");
//獲取最小值min()
document.write(Math.min(1,10)+'<br>');
//獲取最大值max()
document.write(Math.max(10,1)+'<br>');
//隨機數random()
document.write(Math.random());


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章