【发布时间】:2022-07-06 04:03:36
【问题描述】:
示例: 如果我使用下面的代码,它适用于整个单词“gorilla”。
如何让它与“gor”或“illa”或“orill”一起使用...?
...(例如,相当于mysql中的“%gor%”之类的str)
const jungle = [
{ name: "frog", threat: 0 },
{ name: "monkey", threat: 5 },
{ name: "gorilla", threat: 8 },
{ name: "lion", threat: 10 }
];
const names = jungle.map(el => el.name);
// returns true
document.write(names.includes("gorilla"));
【问题讨论】:
标签: javascript arrays