Push to array not working inside If statement, but works one level higher in for loop. Google Script / JavaScript

I am trying to parse through a 2D array, remove empty cells, and then push it to a new 2D array. When I do the .push([]) step before the IF statement, everything works fine but unfortunately that pushes an empty array every iteration of the for loop. When I try to put that line within the If statement, I get the following error: TypeError: Cannot read property ‘push’ of undefined.

This doesn’t work:

  var i=0;
  var oA = [];

  for(i; i<bRows;i++)
  {  
  
    if(nbaValues[i][0]){
      oA.push([]);
      for(var j=0;j<bCol;j++){
          
        oA[i].push(nbaValues[i][j]);
        }
    }

  }
  Logger.log(oA);

While this works:

  var i=0;
  var oA = [];

  for(i; i<bRows;i++)
  {  
    oA.push([]);
    if(nbaValues[i][0]){
      
      for(var j=0;j<bCol;j++){
          
        oA[i].push(nbaValues[i][j]);
        }
    }

  }
  Logger.log(oA);

Thanks in advance!