摘要: function getNum(k,arr){ const res = arr.sort((a,b)=>{b-a});//数组排序 let set = new Set(res); // 数组去重 let newarr = Array.from(set);// 类数组转数组 if(typeof new 阅读全文
posted @ 2021-07-13 16:39 与七个小矮人 阅读(100) 评论(0) 推荐(0)
摘要: 1.数组去重 arr = [1,2,3,4,5,undefined,undefined,NAN] newarr = ...new.set(arr); newarr => 1,2,3,4,5,undefined,NAN 阅读全文
posted @ 2021-07-13 11:46 与七个小矮人 阅读(71) 评论(0) 推荐(0)
摘要: Object.assign方法用于对象的合并,将源对象(source)的所有可枚举属性,复制到目标对象(target) const target = { a: 1 }; // 目标对象 const source1 = { b: 2 }; // 源对象 const source2 = { c: 3 } 阅读全文
posted @ 2021-07-13 11:35 与七个小矮人 阅读(721) 评论(0) 推荐(0)