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 another prompt but when the user doesn't enter anything it loops back to the first prompt which is ask for the users name. If the user enters a valid input it then goes to the program prompt where if the user enters any input it proceeds but if the user doesn't it loops to the same prompt this is html embedded with java script Welcome
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 another prompt but when the user doesn't enter anything it loops back to the first prompt which is ask for the users name. If the user enters a valid input it then goes to the program prompt where if the user enters any input it proceeds but if the user doesn't it loops to the same prompt
this is html embedded with java script
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome</title>
<meta name="description" content="Template">
<meta name="author" content="Tafadzwa Marisa">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script>
let welcome;
welcome = "Welcome to my first COMP1231 Program.";
alert(welcome)
let name;
name =(prompt("Please enter your name:?", "Tafadzwa Marisa" ));
let program;
program =(prompt("Please enter your Program:?", "COMP1231" ));
</script>
<script src=https://my.gblearn.com/js/loadscript.js></script>
</body>
</html>
Step by step
Solved in 3 steps with 5 images