Stuck on 11 -- where am I going wrong?


#1

Hi friends!

I’m sort of embarrassed that I can’t seem to get my head around this, but can someone help me figure out where I’m going wrong? So far, I’m working with:

function lightColumn(coordinate)
{
let targetColumn = [];
column = convertColumn(coordinate);
for (row = 0; row < GRID.length; row++)
{
targetColumn.push(column[row]);
}
return targetColumn;
}

Maybe I’m going about this in a completely wrong way?


#2

You’re so close!

Your train of thought is spot-on, as is your structure. However, you should double-check what you’re pushing to your targetColumn variable. It isn’t what you expect it to be.


#3

You’re very close! Think about how you get the content of cell and then expand it to get the whole column.

Hint: It is the same approach as what you did for “lightCell” function.


#4

Thanks so much, you two! Those were exactly the hints I needed. :slight_smile: Solved!


#5

Hey, I am stuck on this as well. I have done something very similar. Any other clues? I want to do it myself. I don’t know how to push the value of the cell into the array. How can I push the contents of the cell in the first column into an array and then just repeat for the number of rows and then just return that?


#6

What fixed it for me was that I wasn’t pushing the column or row FROM anything… or to put it another way, I was missing a critical part of pushing [row] and [column].


#7

oh so would u have to look at the coordinate and then push the index of the coordinate for each row?

im actually confused


#8

function lightColumn(coordinate){
let targetColumn = [];
column = convertColumn(coordinate);
for (row = 0; row < GRID.length; row++){
targetColumn.push(GRID[column[coordinate]-1]);
}
return targetColumn;
}
thats what i have