摘要: 原生Math.max方法 Math.max 方法不能接收数组,可以使用ES6的...将数组打散 const arr = [111, 12, 111, 34, 2, 5, 76]; console.log(Math.max(...arr)); 当然也可以用apply方法调用 console.log(M 阅读全文
posted @ 2021-02-22 20:18 LiuWango 阅读(7095) 评论(1) 推荐(0) 编辑
摘要: 双重for循环依次比较 将结果函数中的元素与原数组中的元素依次比较,重复的元素舍弃,不重复的元素添加仅结果函数。 function removeRepeatArr(arr) { const result = []; for (let i = 0, len = arr.length; i < len; 阅读全文
posted @ 2021-02-22 11:09 LiuWango 阅读(921) 评论(0) 推荐(0) 编辑