Math.min(a,b,...,x,y) -- 返回数个数字中较小的值
min函数返回值返回数个数值中较小的值
如果min函数没有给出任何参数,返回Infinity
如果有NaN或者非数字类型的参数,返回NaN
document.write(Math.min(5,8,6,-5,-6));document.write(Math.min());document.write(Math.min("dreamdu",8));document.write(Math.min(NaN,0));结果:
-6InfinityNaNNaN
2. math.abs() method
Math.abs(x) -- 返回数字的绝对值 abs是absolute value的缩写,中文"绝对值"的意思 引用网址:http://www.dreamdu.com/javascript/Math.abs/ abs函数语法Math.abs(x);abs函数参数x -- 为number类型的数字。abs函数返回值返回x的绝对值
abs函数示例document.write(Math.abs(6));document.write(Math.abs(-6));结果:
66