js判断int数组是否存在某个值
电脑版发表于:2022/2/11 14:46
indexof即可
找到就返回具体的值,找不到就是-1
let arr = ['something', 'anything', 'nothing', 'anything','game']; let index = arr.indexOf('nothing');
indexof即可
找到就返回具体的值,找不到就是-1
let arr = ['something', 'anything', 'nothing', 'anything','game']; let index = arr.indexOf('nothing');