如何在JavaScript / jQuery中查找数组是否包含特定字符串? [重复]

▼魔方 西西 提交于 2020-08-10 18:27:08

问题:

This question already has an answer here: 这个问题已经在这里有了答案:

Can someone tell me how to detect if "specialword" appears in an array? 有人可以告诉我如何检测"specialword"出现在数组中吗? Example: 例:

categories: [
    "specialword"
    "word1"
    "word2"
]

解决方案:

参考一: https://stackoom.com/question/PfAo/如何在JavaScript-jQuery中查找数组是否包含特定字符串-重复
参考二: https://oldbug.net/q/PfAo/How-to-find-if-an-array-contains-a-specific-string-in-JavaScript-jQuery-duplicate
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!