如何判定一个字符串是否属于一个数组
javascript吧
全部回复
仅看楼主
level 7
prlanhong
楼主
字符串: var iu='e1234';
数组: pic=['e1234','hello','how are you']
除了用indexOf()外,还有其他好方法吗?
2021年04月08日 09点04分
1
level 12
丶影-奈斯
var iu = 'e1234';
const pic = ['e1234', 'hello', 'how are you'];
const bContain = pic.includes(iu);
alert(bContain);
2021年04月08日 10点04分
2
level 12
丶影-奈斯
你说比indexOf更好方法的话
2021年04月08日 10点04分
3
prlanhong
多谢前辈指教
2021年04月08日 23点04分
level 1
飞行在辽阔天空
来一起交流Java呀~没有广告,不卖资料,真正的Java交流群:156122099
2021年04月08日 16点04分
4
1