I am assuming that you used allTargets() for your allRocks() implementation.
Now I think the problem is your implementation for firstRock(). When you push
first_rock, it would become something like this:
let rocks = allTargets("^"); // output is ['D1', 'E3', 'F3', 'E4', 'F4', 'B8', 'H8', 'B9', 'B10']
first_rock = ;
first_rock = first_rock.push(rocks); // output is [['D1', 'E3', 'F3', 'E4', 'F4', 'B8', 'H8', 'B9', 'B10']]
return first_rock; // returns ['D1', 'E3', 'F3', 'E4', 'F4', 'B8', 'H8', 'B9', 'B10']
This is because you are pushing the whole array of
rocks, making your first_rock an array of array(s).
Now here’s my hint for you, take a look at your implementation of allRocks(). It should return the same thing as your
rocks. Then, you just need to return the first element of that.
Hope this helps!