<script>
var arr = [1,2,3,[1,2,3,1,3,[1,2,3,6,4,[1,2,3,1]]],2];
let last = []
function multiarr(arr){
let k=0
for (let i=0;i<arr.length;i++){
if(arr[i] instanceof Array){
k++
arr = arr[i];
multiarr(arr);
}
}
if(k==0){
last = arr
}
return last
}
console.log(multiarr(arr));
</script>
网友评论