How to make "restart" on JS (in game) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to make "restart" on JS (in game)

10th Jul 2018, 3:05 PM
Орхан Джафарли
6 Answers
+ 2
window.location.reload(true);
10th Jul 2018, 3:21 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 1
it don't works! Why?!
10th Jul 2018, 3:29 PM
Орхан Джафарли
+ 1
Do you want to restart the game or the page
10th Jul 2018, 3:37 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 1
game, because... just write
10th Jul 2018, 3:39 PM
Орхан Джафарли
+ 1
try putting game in a function and executing it again like function game(){ //Your Code } var a = true; while(a){ game(); a = confirm("Do you want to play again?"); }
10th Jul 2018, 3:42 PM
Mert Yazıcı
Mert Yazıcı - avatar
0
Thank you very much!!! Rate my code, please:) https://code.sololearn.com/WaCs0gAq79wT/?ref=app
10th Jul 2018, 4:20 PM
Орхан Джафарли