Open zhh10 opened 4 years ago
let arr = new Array(100).fill(0).map((item,index) => index + 1)
let a = [1,2,3]
let b = [3,4,5]
let c = [...new Set(a)].filter(item => b.includes(item))
let a = [1,2,3]
let b = [3,4,5]
let c = [...new Set([...a,...b])].filter(item => !a.includes(item) || !b.includes(item))
let arr = [1,2,3]
let obj = {...arr}
let arr = [1,2,3,4,5]
arr.every(item => typeof item === 'number')
let arr = [1,2,3,4,5]
arr.some(item => typeof item === 'number')
let arr = [1,2,3,4,5]
let findItem = arr.find(item => item === 3)
// 找到子项
let findIndex = arr.findIndex(item => item === 3)
// 找到子项对应的下标
使用splice
循环迭代
使用es6 Set去重
使用filter
使用对象去重