I have a tiny and simple JavaScript greeting script here
My goal is to detect if the user has submitted an empty string in the prompt box, then continue to prompt until the user finally gives in and types something in
The issue is, it correctly detects and empty string, but even when you type something in it still exectutes the while loop to continue prompting, therefore the code gets stuck in an infinit loop of Promt boxes
How would I break away from the while loop once the user has given a value?
var Name = prompt("Insert Name");
while(Name === ""){
prompt("Empty")
}
document.write("Hello " + Name)