Math绝对值和三个取整数方法
//1.绝对值方法
console.log(Math.abs(1)); //1
console.log(Math.abs(-1)); //1
console.log(Math.abs('-1')); //1 //隐式转换 把字符型转换为数字型
console.log(Math.abs('pink')); //NaN(不是一个数字 非数字型)
//2.三个取整方法
//(1)Math.floor() // 向下取整
console.log(Math.floor(1.1)); //1
console.log(Math.floor(1.9)); //1
//(2)Math.ceil() //向上取整
console.log(Math.ceil(1.1)); //2
console.log(Math.ceil(1.9)); //2
//(3)Math.round() 四舍五入
console.log(Math.round(1.6));//2
console.log(Math.round(-1.5)); //-1