网络编程
位置:首页>> 网络编程>> JavaScript>> JavaScript Math 对象常用方法总结

JavaScript Math 对象常用方法总结

作者:jingxian  发布时间:2024-06-05 09:33:56 

标签:JavaScript,Math,对象

Math.abs(x):可返回数的绝对值

Math.ceil(x):向上取整

Math.floor(x):向下取整

Math.max(x,y):最大值

Math.min(x,y):最小值

Math.random(x):随机数

Math.round(x):四舍五入

获取指定范围内的随机数

var x=Math.floor(Math.random()*(max-min+1))+min;

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com