DEV Community

Blactot
Blactot

Posted on

Add loop for with condition

var accueilsite = "Bonjour à toi Aventurier, es-tu prêt à te lancer dans une lutte sans merci contre Le Maître du Hasard";
alert(accueilsite);

var tapname = prompt("Afin de personnaliser votre avatar peux-tu m'indiquer ton nom ?");
for
if (tapname != null) {
alert("Merci " + tapname + "\nNous allons pouvoir commencer maintenant, bon courage...");

}
Enter fullscreen mode Exit fullscreen mode

// I would like a loop that allows me that:
1) if the user enters his name then he can continue
2) if he does not enter his name (that he does not enter anything) then we ask him again to enter his name in order to continue.

I am working on a JavaScript program I am a beginner.

Top comments (0)