How to keep looping while condition is false and stop looping until the condition is true?

Viewed 16

function nameInput(){
    nameOutput = prompt("Enter your name...");
    return nameOutput;
}

let result = nameInput();

    if (nameOutput == false){
        console.log("Must be filled !");
        nameOutput = prompt("Enter your name...");
        
    } else {
        document.write(`Hello, ${result} !`);
        console.log("Complete!");
    }

I want keep looping while condition is false and looping is stop until the condition is true, but this statement gave me the false condition only a few loops. Anyone can help me?

0 Answers
Related