首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

js如何判断数组包含某个特定_js数组是否包含某个

array.indexOf 判断数组是否存在某个,如果存在返回数组元素下标,否则返回-1 let arr = ['something', 'anything', 'nothing',...参数:searchElement 需要查找元素。 参数:thisArg(可选) 从该索引处开始查找 searchElement。...numbers.includes(8); # 结果: true result = numbers.includes(118); # 结果: false array.find(callback[, thisArg]) 返回数组满足条件第一个元素...== 3; }); # 结果: Object { id: 3, name: "nothing" } array.findIndex(callback[, thisArg]) 返回数组满足条件第一个元素索引...方法,该方法返回元素在数组下标,如果不存在与数组,那么返回-1; 参数:searchElement 需要查找元素

18.3K40
领券