Math.ceil 、Math.floor 、 Math.random

向上取整 Math.ceil
//向下取整 Math.floor
//随机数(0-1) Math.random
// var num = 0.14;
// var num1 = 100;

// document.write(Math.ceil(num * num1)+ " ");//15
// document.write(Math.floor(num * num1)+ " ");//14
// document.write(Math.random(num * num1));//0-1之间随机数

posted on 2022-07-03 11:20  爱前端的小魏  阅读(32)  评论(0编辑  收藏  举报

导航