I am making a game in JavaScript and when the user wins/loses I am prompted them if they would like to play again.
Instead of reseting all the vars, is there a way to just reload the page?
I am making a game in JavaScript and when the user wins/loses I am prompted them if they would like to play again.
Instead of reseting all the vars, is there a way to just reload the page?
Sure, use reload
:
location.reload();
You can also load other documents with the replace
method:
location.replace("/other_page.html")