摘要: let person = [ {id: 0, name: "小明"}, {id: 1, name: "小张"}, {id: 2, name: "小李"}, {id: 3, name: "小孙"}, {id: 1, name: "小周"}, {id: 2, name: "小陈"}, ]; let ob 阅读全文
posted @ 2022-03-21 10:35 骑蝴蝶飞 阅读(1666) 评论(0) 推荐(0) 编辑
摘要: 1.数组去重 const newArr= new Set(array); 2.set类型转换为数组 Array.from(newArr) 连写 const newArr= Array.from(new Set(array)); 阅读全文
posted @ 2022-03-21 09:49 骑蝴蝶飞 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 1、获取两个数组中相同的元素 var arr1 = [0,1,2,3,4,5]; var arr2 = [0,4,6,1,3,9]; function getArrEqual(arr1, arr2) { let newArr = []; for (let i = 0; i < arr2.length 阅读全文
posted @ 2022-03-21 09:37 骑蝴蝶飞 阅读(4795) 评论(0) 推荐(0) 编辑