var arr =[[1,2,3,4],[2,3,5],[2]];
function test(){
var array=[];
var t1 =arr[0];
var t2= arr[1];
t1.forEach(function(e){
t2.forEach(function(f){
if(e == f){
array.push(f)
}
})
});
arr.splice(0,2,array);
if(arr.length != 1){
test();
} else {
console.log(arr[0]);//2
return arr[0];
}
}
console.log(test()) ;//拿不到[2]
// 当arr=[[1,2,3,4],[2,3,5]]可以获取到[2,3]