JavaScript封装的Math对象 芒果水蜜桃 2022-08-12 93 阅读1分钟 Math.floor();向下取整 Math.ceil();向上取整 Math.round();四舍五入 Math.abs();去绝对值 Math.max()/min();取最小值 const array = [0, 1, 2, 3, 4, 15, 6]; console.log(Math.max(...array)); //注意 或 console.log(Math.max(0, 1, 2, 3, 4, 15, 6)); 随机数方法:random()