var noSomeNum=""
function getNoNum(arr){
var index=0
var str=Math.floor(Math.random() * (1000 -0)) + 0
if(arr.length>0){
for (var i=0;i<arr.length;i++){
var id=arr[i].id
if(id==str){
index++
}
}
if(index==0){
noSomeNum=str
}else{
getNoNum()
}
}else {
noSomeNum=str
}
}
```
生成数组里面不存在的数
猜你喜欢
转载自blog.csdn.net/weixin_45264424/article/details/108800083
今日推荐
周排行