function insertArr(arr,newarr){
var num=parseInt(Math.random()*arr.length);
newarr.push(arr.splice(num,1)[0]);
if(arr.length==0){
return newarr;
} else {
return insertArr(arr,newarr);
}
}
insertArr([1,2,3,4,5,6],[]);
时间: 2024-10-11 23:12:06