情不知从何起,一往而情深
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术

js判断int数组是否存在某个值

3184人阅读 2022/2/11 14:46 总访问:771549 评论:0 收藏:0 手机
分类: 前端



indexof即可
找到就返回具体的值,找不到就是-1

let arr = ['something', 'anything', 'nothing', 'anything','game'];
let index = arr.indexOf('nothing');


欢迎加群讨论技术,群:677373950(满了,可以加,但通过不了),2群:656732739

评价