JS判断元素是否在数组内的实现代码

cishitianya 28 0 PDF 2020-11-26 19:11:44

一、JQuery 如果是用JQuery的话,可以用inArray()函数: jquery inarray()函数详解 jquery.inarray(value,array) 确定第一个参数在数组中的位置(如果没有找到则返回 -1 )。 determine the index of the first parameter in the array (-1 if not found). 返回值 jquery 参数 value (any) : 用于在数组中查找是否存在 array (array) : 待处理数组。 用法为: 复制代码 代码如下: $.inArray(value, array)

用户评论
请输入评论内容
评分:
暂无评论