JS中Math函数的常用方法

Math 是数学函数,但又属于对象数据类型 typeof Math => ‘object’ console.dir(Math) 查看Math的所有函数方法。 1,Math.abs() 获取绝对值 Math.abs(-12) = 12 2,Math.ceil() and Math.floor() 向上取整和向下取整 3,Math.round() 四舍五入 注意:正数时,包含5是向上取整,负数时包含5
相关文章
相关标签/搜索