Skip to content

数组去重

js
const arr = [1, 1, '1', 17, true, true, false, false, 'true', 'a', {}, {}];
// => [1, '1', 17, true, false, 'true', 'a', {}, {}]
js
function unique(array) {
  return [...new Set(array)];
}

MIT Licensed | 沪ICP备20013265号-1 | Copyright © 2019-present AaronKong