var   a=[1,2]
var   b=[3,4]
var   c=[5,6]
var   d=[7,8,9]
var  rows=[a,b,c,d]
console.log(rows.length)
var  mid=[]
for(let i=0;i<rows.length;i++){
  if(mid.length==0){
      console.log("in..........")
    let one=rows[i] 
    let two=rows[++i]
    console.log(two,"..........")
    one.forEach(item=>{
          two.forEach(c=>{
              mid.push(item+"|"+c)
          })
    })
  }else{
     let next=rows[i]
     let tmparray=[]
     mid.forEach(m=>{
         next.forEach(n=>{
            tmparray.push(m+"|"+n)
         })
     })
     mid=tmparray
  }
}
console.log(mid)



