Math 是数学函数,但又属于对象数据类型 typeof Math => ‘object’
console.dir(Math) 查看Math的所有函数方法
Math对象
Math.random() 随机数
Math.random():产生一个[0,1)之间的随机数
// 获取[0,10]的随机整数
Math.round(Math.random()*10)
// 获取[n,m]之间的随机整数
Math.round(Math.random()*(m-n)+n)
Math.abs() 绝对值
Math.abs(-12)