Challenge 6 i can't find the error need help


#1

Hi can some one help pls

function countRows() {

 return GRID.length;

}

function countColumns() {

 return GRID[0].length;

}

function gridSize() {

let width = countColumns();
let height = countRows();

return width + ’ x ’ + height;

}

function totalCells(){

totalC = countColumns() * countRows();

return totalC;
}

function convertColumn(col){

var alpha = ['A','B','C','D','E','F','G','H','I','J','k','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
        let count;
      
      for (var i = 0; i < alpha.length; i++){
        
         if (col.charAt(0) == alpha[i]){
           
            return  alpha.indexOf(col.charAt(0));
         }
        
      }  

}

function lightCell(col){

  return GRID[col.charAt(1)][convertColumn(col)];

}


#2

If your lightCell() is given a value of A12 your current function would attempt to return GRID[1][0] when in reality you would want it to return GRID[11][0] . Start by looking for a method to account for rows above 10 and the zero index array of the array.

Does this help?


#3

Thank you for the help