Mole Unearther error

I am currently dealing with Mole Unearther : https://www.codecademy.com/paths/create-video-games-with-phaser/tracks/game-dev-learn-javascript-function-and-scope/modules/game-dev-project-functions-and-scope/projects/mole-unearther .

I have completed 16 steps without any issues whatsoever, but at the 17th step, I’m sort of lost, because when I tried to complete it, I started getting an error of “Unexpected token: {” at the line 137, which is initializeBackground() { ; and I also get an error of "Reference Error: GameScene is not defined at game.js : 9 ". And I haven’t gotten it before step 17, so what gives? Could I have accidentally deleted something, or input something I shouldn’t have to cause an error like that?

Thank you for your answers :slight_smile:

Hello, and welcome to the forums!

Unexpected token errors often mean there’s an issue somewhere above the line being reported. It could be a missing or extra curly brace, an out of place parenthesis, etc. This can cause the JavaScript interpreter to continue reading the code looking for something that isn’t there, then it finds something that should be impossible and raises the error.

If you need a second set of eyes on it, you can click the Tools button in the top-right of the project page and then click this:
image

Posting the link generated from that will allow us to see your code.

A second set of eyes would greatly help, so the link is: https://gist.github.com/95a85b4803de0474c50ae1f07a6909bb

Check out this block of code

		// user successfully hit the mole, so reward the user with 5pts
    const updateScore = () => {
     
		const applyHitReward = () => {
      
			// display how many points the user will gain
			this.displayRewardText();

			// display the new score to the user
			this.updateScoreText();
		};

On line 87, updateScore is missing the end curly brace } so applyHitReward() and a bunch of other code ends up becoming part of that function. This causes a chain reaction and the interpreter eventually can’t figure out what to do when it reaches line 137.

Yessssssssssssssssssssssssss, thank you very much for solving that, can’t believe I missed it…