JS刷题常用函数及问题
1 初始化为0的数组
//二维数组
const visited = new Array(rows).fill(0).map(() => new Array(columns).fill(false));
//一维数组
var arr = new Array(10).fill(0);
2 排序
3 整除
Math.ceil(count / pagesize); //向上整除 4/3=2;
Math.floor(count / pagesize); //向下整除 4/3=1;
Math.round(5/2);//四舍五入
Math.parseInt(5/2);//丢弃小数部分,保留整数部分
//绝对值
Math.abs(-5);//5
4 最大值
Number.MAX_VALUE
console.log(Number.MAX_VALUE