开发工具与关键技术:visual Studio jquery
作者:邓伟征
撰写时间:
Math(算数)对象的作用是:执行普通的算数任务。
Math对象提供多种算数数值类型和函数。无需在使用这个对象之前对它进行定义。
round方法:对一个数进行四舍五入
document.write(Math.round(9.9) + “
”);
random()方法:返回一个介于0到1自己的随机数
document.write(Math. random + “
”);
Floor方法:去除余数取整数
document.write(Math.floor(8.8) + “
”);
使用了 Math 对象的 floor() 方法和 random() 来返回一个介于 0 和 100之间的随机数
document.write(Math.floor(Math.random() * 111))
Max()方法:获取数组中最大的数
document.write(Math.max(13, 12,11) + “
”)
document.write(Math.max(14, 4,6) + “
”)
document.write(Math.max(-3, 5,-1) + “
”)
document.writ