Challenge #2 does not produce the correct result: SOLVED


#23

Put the functons countRows and countColumns outside of the function gridSize


#24

One problem that I had was I solved the code a while ago but I didn’t delete the code from Challenge 1 so it wouldn’t take the answer.

Just in case anyone else didn’t delete the countRows function. The answer is actually really simple.


#25

Thanks for your input. I put countRows() and countColumns() outside of girdSize() function and its still not working on LHL but in the browser console it gives the correct response.


#26

thanx guys , i got it :sunglasses::sunglasses::sunglasses:


#27

Hi

do you see something wrong with the code below

function countColumns(){

var rows = 10;
var col = 10;

var GRID = [];
var nbCol = [];
var colomns = 0;

for (var j = 0; j < rows; j++){

  GRID[j] = j;

for (var i = 0; i < col; i++){
  
 nbCol[i] = GRID[0][i];
 
}

}
//colomns = nbCol.length * GRID.length;
colomns = GRID.length * nbCol.length;

return colomns;

strong text