js检测dict中是否包含某个key 数组中是否含有某元素

时间:2020-06-01 21:00:45   收藏:0   阅读:484

dict

ary.hasOwnProperty(key)

 

https://blog.csdn.net/donggx/article/details/53373497?utm_source=blogxgwz8

 

 

list

https://www.cnblogs.com/zaijin-yang/p/12196811.html

 

array.includes(searcElement[,fromIndex])

此方法判断数组中是否存在某个值,如果存在返回true,否则返回false

var arr=[1,2,3,4];
if(arr.includes(3))
    console.log("存在");
else
    console.log("不存在");
 

原文:https://www.cnblogs.com/jxfy/p/13027024.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!