How to check if the target variable is in an array?
This question already has an answer here:
you can use indexOf methd of array https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
if(doingGood.indexOf(target) !== -1){
// do something
}
链接地址: http://www.djcxy.com/p/19306.html上一篇: 如何检测一个变量是否是一个数组
下一篇: 如何检查目标变量是否在数组中?