js判断数组中有没有指定元素

list.findIndex(target => target.sel === 指定元素) ,如果找到返回下标,如果没有返回-1

猜你喜欢

转载自www.cnblogs.com/dianzan/p/10714933.html