I'm learning some basic javascript, and would like to learn how to return to the beginning of a method when certain conditions are met.
In this scenario, the user must enter a character in the prompt in order to proceed to the statment "The character you typed was" string. I would like to implement a loop to send the program back to the start of the method if nothing is entered. I have the following, so far:
<script class="promptwindow">
var x
x = prompt("Please type a character in the box and click OK", "")
if (x = null)
{****}
document.write("The character you typed was ", x)
</script>
I'm unsure what to use in the **** bracket, I need something similar to goto.
Edit: Yep, should have been ==. I'll leave the mistake there so that the comments make sense.
class="promptwindow"inscripttag?if (x = null)yes ->if (x == null)