【发布时间】:2019-06-10 09:00:14
【问题描述】:
我想知道 [{title:'ccc'},{title:'abc'},{title:'ddd'}] 中是否有 'abc'
let a = 'abc'
let b = [{title:'ccc'},{title:'abc'},{title:'ddd'}]
if there is a in b{
return 'yes'
} else {
return 'no
}
//这个怎么做以及如何判断
【问题讨论】:
-
@Veverke 我不同意。重复的帖子将搜索数组中的整个条目。这里的 OP 要求匹配条目的一部分。
-
@JamesLong:你说得对,James,我正在取消我的投票。
标签: javascript arrays object ecmascript-6