Closed irishjack490 closed 11 months ago
The issue is coming from your function setMines() {}
. Try commenting it out, and starting it again from scratch, being sure to check your browser/console at each step to isolate what the exact problem is. My best guess is that your while loop is creating an infinite loop and you'll need to investigate why (also change minesRemaining = +1
to minesRemaining += 1
- this will not solve your problem but it's better syntax)
Thanks so much for the response, I will try that
The suggestion worked. Thanks a bunch for the direction. I commented everything out starting at the set mines function. The boxes returned. I corrected the typo. I revised the boxClicked() and the countAdjacentMines() functions. I noticed I was trying to work with i,j instead of the id coordinates I set up initially when setting up div tags. The game works now. Thanks for the advice. Now I'll be working on making sure player can't click on any other boxes if game is over and want to add a button to play again.
What's the problem you're trying to solve?
My game loads partially when going live, there is an illegal return statement error message in the console, when I change it, the game will not load. If I leave the illegal return statement, the page will load but the board does not show the boxes and nothing will happen if I click on it
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
There is an Uncaught SyntaxError: Illegal return statement for last line of the code but if I change it the game will no longer load. If I leave it, game will load partially without the cells and the functionality it needs.
What is your best guess as to the source of the problem?
The return statement, but it if I make any changes, the game will no longer load
What things have you already tried to solve the problem?
I have looked for solutions on the Internet, so far here is what I have I have tried re-starting VS code, I have set the Ip to local in VS code settings, I have added live property inside settings.JSON
Paste a link to your repository here
https://github.com/irishjack490/Project-1---Browser-Based-Game