How to create a while loop with javascript

So l am trying to use a prompt which asks a user for their name and when the user enters a name it proceeds to the program prompt but when the user doesn’t enter anything it loops back to the name prompt

 let welcome;
  welcome = "Welcome to my first COMP1231 Program.";
 let name;
  name =(prompt("Please enter your name:?", "Tafadzwa Marisa" ));
   let program;
  program =(prompt("Please enter your Program:?", "COMP1231" ));

Thy this one as starting point:

function whatBring() {
    var input = prompt('What brings Little Red Riding Hood in the basket?  A: Food - B: Book - C:Carbon') == 'A');

    if (input == "A") {

    } else if (input == "B") {

    } else if (input == "C") {


Have you tried anything? Please show us the code for what you have tried so that we can help you out.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.