<p id="demo"></p><p>
<script>
function myFunction(){
let text;
let p=prompt("Please enter your name:");
if (p==null||p==""){
text="User cancelled the prompt.";
}else{
text="Hello Mr. "+p+"! How are you today?";
}
document.getElementById("demo").innerHTML=text;
}
</script>
0 Comments