注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
第一题- const items = [
- {type: 'a', name: 'a1', color: 'yellow'},
- {type: 'b', name: 'b1', color: 'orange'}
- ]
- const excludes = [
- {k: 'color', value: 'yellow'},
- {k: 'name', value: 'x'}
- ]
复制代码 然后给示例代码- excludes.forEach((exclude) => {
- items = items.filter((item) => item[exclude.k] !== exclude.value)
- })
复制代码 分析复杂度,改进,分node)
不可以用 Map
分析复杂度
|