How could I make the function loop after it is complete?
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <center><br><br><br><br><br><br><br><br><br><button type = "text-align:center;" onclick = "FunctionBoi()"> Click to flip a coin </button></center> <script> function FunctionBoi() { var maan = Math.random (); if (maan <= .50){ document.write("<center><br><br><br><br><br><br><br><br>You flipped Tails</center>") var tails = true; if (tails == true) { console.log("Tails");} } if (maan >= .50) { document.write("<center><br><br><br><br><br><br><br><br><br>You flipped Heads</center>"); var heads = true; if (heads == true) {console.log("Heads")} } function Restartloop(){ document.body.innerHTML = ''; } setTimeout(Restartloop , 2000); if (tails == true); { setTimeout(Restartloop , 2000); } if (heads == true); { setTimeout(Restartloop , 2000); } }