Skip to content
Advertisement

How do I fix this syntax error in my game?

I was creating a guessing game for practice and this syntax error came up in my code which says that my break function is outside the loop. I looked at my code and it is not outside the loop so I would appreciate it if someone could help me with my problem.

JavaScript

This is the error I get:

JavaScript

Advertisement

Answer

Check the indentation of the last few lines and make sure they’re inside the while loop and it will work.

JavaScript

Repl: https://repl.it/repls/TurbulentImpeccableObjectdatabase

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement