js如何从数组里面随机获取1个或多个数字
js如何从数组里面随机获取1个或多个数字
//jquery随机数字 var arr = ['xas2232','xas2210','xas2209',]; //输出数组 var out = []; //输出个数 var num = 1; while(out.length < num){ var temp = (Math.random()*arr.length) >> 0; out.push(arr.splice(temp,1)); } alert(out)