Treasure Hunter, got stuck but don't know where

I got stuck in the Treasure Hunter game, but I dont know where it went wrong. From the 7th task untill the end, there are no real check points to see if my code is still working. In none-game excercises I can see the syntax errors and can “console.log()” many things to the console. I guess even one missed capital letter in task 7-24 could be a disaster, but it doesn’t show anywhere where the mistake might be. Is there any way to see the syntax errors etc like in a normal excercise where there is nog game showing in the console?

Also I tried to download the end solution, and the index.html brings me to the working game in a browser, but the GameScene.js does not open, probably I need a coding program to open it? Is there any in particular you could recommend me?

Thanks for your advice!

Can i see your code? And the project url?

You can use the developers tools of your browser to see the JS file, but if you really want to make changes, a text-editor/IDE is recommended.

Vscode gained a lot of popularity of late, but there are many others (atom, jetbrains and many more)

in the end, you need to learn to debug your own code. Thankfully browsers come with a console and other useful devtools, maybe now is a good time to look into that?

Hi, thanks for your reply!

the link to the project =

I managed to open the index.html file and then f12 -> Debugger where I could see the code that I was looking for.

let decideCoinLocations = () =>{
        while (coinCollection.length < 5){
          let randIdx = Math.floor(Math.random() * grid.length)
          let selectedPlot = grid[randIdx]
          if (coinCollection.indexOf(selectedPlot) === -1){

my mistake was that I had “while (coinCollection.length < 5)” as "while (coinCollection.length() < 5)

so instead checking for the the length of coincollectioni made it check for the outcome of a function if I am correct.

I will look into the different kinds of text editors, and will probably start with Vscode to check out things.


Debugger is also useful, allows for break points to step through your code

the console is also useful for errors

Hi, I had problem with 19… I removed the comments but I can not see the highlight effect :confused: and is codecademy’s code so I dont know if is the browser I’m using (I’ve tried with chrome, safari and Mozilla)