Challenge 7 - No feedback, no error, not passing


#1

Hi! Disclaimer first: I now solved challenge 7, I’m only writing this because I assume there is a bug in the website.

I tried to solve it with a more complicated piece of code first, since I didn’t know if comparing a string to an empty string would get me into trouble. What I did was

function isRock(coord) {
    object = lightCell(coord);
    rock = "^";
    if (object.length === 0) {
        return false;
    } else if (object === rock) {
        return true;
    } else {
        return false;
    }
}

Whenever I clicked Solve, the Solve-button stopped reacting. I waited for several minutes but nothing happened and there was no feedback on my solution either. When I reloaded the page, the new function was gone and when i copied it back in and hit Solve, exactly the same thing happened again.


#2

Without having looked at the rest of your code… Usually when declaring a variable you have to use “let, var, const” in front of the variable name.

let object = lightCell(coord);
let rock = "^";

Also, you are trying to find for true or false. So instead of having two instances where it returns false, why not just doing:

if this happens
return true;
else
return false;

This is what I used to test for true:

(lightCell(coordinate) === '^')

Let me know if this helps.


#3

I don’t know, since as I said I already solved the challenge another way. I mainly was irritated that the site doesn’t tell me what is wrong but just stops working.

That aside, thank you for your answer, I’m gonna look into what let, var and const do. I’ve never used them, but I’m also completely new to JS.


#4

I had the same problem with challenge 7 - must be a bug. Mine would not pass all day, and I used similar logic to yours. In the end I could only move on when I reversed the logic on the following day and returned false when it found a rock. When it finally ‘passed’ it didn’t tell me I passed it just took me back to the main menu but it showed the challenge as being completed.