Challenge 6 - Help please?


#1

Possible solution below
The accepted solution is GRID[col-1][row], but I believe it should be GRID[col][row-1]. What am I overlooking?


#2

What am I overlooking?

First hint: Both your answers are wrong.
Second hint: When you say GRID[a][b]… Check a little closer what a and b are actually referencing in your grid.


#3

You’re right, so would the answer be:
GRID[parseInt(coordinate[1])-1][convertColumn(coordinate)]?


#4

Ah, thanks for this! I had the wrong order. I guess it did not help that when I did this in a code editor, nothing was returned… maybe for the future, I will type in all the cell coordinates in my sample to make sure it comes back ok.


#5

I am having a similar issue that my code is running but I am getting that it is not the correct outcome. However I am doing it a little bit different way. Hoping to get some help/direction as to why I am not getting the right answer

I am passing in ‘arg’ to my function with these definitions:
var col = convertColumn(arg)
var row = arg.substr(1,1)

and then returning GRID[col][row]

The code is running but not getting the correct result. I have also looked to see if I should have a -1 for the row but no dice there. I also tried using the same charCodeAt for the row but that was to no avail.

I am stuck here and hoping for some help!


#6

and then returning GRID[col][row]
I am stuck here and hoping for some help!

I said it earlier in this thread, but I’ll say it again… When you say GRID[a][b], check a little closer what a and b are actually referencing in your grid.


#7

Hey, I have been working on this all day with no luck so far, i have little JS experience and am having a hard time getting todays challenge. I have been trying the code left on this page, changing it to work with my code/variations of it with no luck. Is there any pointers. Thanks


#8

Thanks beentheredonethat! Great hints.


#9

i am stuck!!!
whats wrong with my code?

lightCell = (cell) => {

var row = parseInt(cell.substr(1));
var col = cell.substr(0,1);

var Alphabets = [
‘A’, ‘B’, ‘C’,‘D’,‘E’,‘F’,‘G’,‘H’,‘I’,‘J’];

var column = Alphabets.indexOf(col);

return GRID[row][column];

};


#12

@anoopkular index starts from 0; So your row index should be fixed in return statement.


#13

done with errors ! thanks


#15

Got the problem already