Phaser display not working properly

Hi folks! I’m working on the treasure hunter game in learning phaser w/ javascript.
Whenever I get up to step 13 (and I’ve tried it a few times) my display doesn’t work anymore. All I see is a blank white display:(
Below is my code that seems to have the error, but I don’t know what it is!

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

[https://www.codecademy.com/paths/create-video-games-with-phaser/tracks/game-dev-learn-javascript-arrays-and-loops/modules/game-dev-project-arrays-and-loops/projects/treasure-hunter]

updated code, but this still does not solver the error

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

Should I be looking if the index of the randIdx of the coin collections equals -1?

You should check the browser’s console for errors. Any errors in the console can help you pinpoint exactly what the issues are.

  • Double check how you are comparing the return value of indexOf with -1
  • Double check the value you’re assigning to selectedPlot. Which grid index were you trying to access?
Click for more hints
  • You’re using = instead of === in your if statement condition
  • There’s an extra ) here: grid[randIdx)]

Some of the things you’ve been trying to complete the task may have been correct, but you wouldn’t be able to tell because of other errors.

You got it! Thanks @selectall!