数组去重
2020-10-10 本文已影响0人
砚婉儿
效果:
const arr = [1, 1, '1', 17, true, true, false, false, 'true', 'a', {}, {}];
// => 输出结果:[1, '1', 17, true, false, 'true', 'a', {}, {}]
方法:
const res1 = Array.from(new Set(arr));
效果:
const arr = [1, 1, '1', 17, true, true, false, false, 'true', 'a', {}, {}];
// => 输出结果:[1, '1', 17, true, false, 'true', 'a', {}, {}]
方法:
const res1 = Array.from(new Set(arr));