SOURCE

var a = [1, 2, 3];
var b = [4, ,5, 6];
var c = [];

function rec(item, c) {
  for(var i = 0; i < item.length; i++) {
    if(item[i] == 2) {
      console.log('this is retrun')
      c = [];
      return;
    }
    console.log('this is rec')
    c.push[item[i]];
    rec[b, c]
  }
}

rec[a, c]
console.log(c)
console 命令行工具 X clear

                    
>
console