Below is my array if items that I want to reduce it to a single list of arrays..
var input=[
    [
        2
    ],
    [
        3,
        13
    ],
    [
        4,
        14
    ],
    [
        5,
        15,
        25,
        35
    ]
]
var output=[
    2,
    3,
    13,
    4,
    14,
    5,
    15,
    25,
    35
]
My code:
  function reduceArray(item){
                  for(var i=0;i<item.length;i++){
                      return i;
                  }
              }
    var result=result.map((item)=>{
                   if(item.length>0){
                       return reduceArray(item);
                   }else{
                       return item;
                   }
               }) 
which produces the same result.Can anyone please figure out where I'm doing wrong or any other approach to achieve this..Thanks
 
     
     
     
     
    