Currently the loop is running constantly. It seems my else function is not being read properly. Could someone please send some assistance.
Also when I run it on Google Chrome, the first thing to pop up is a "Hello Null" box meaning that the window.alert function is running automatically.
<html>
<head>
<title>JavaScript Example</title>
<script>
"use strict";
function start() {
let ino = window.prompt("What is your name?");
window.alert("Hello " + ino);
while (ino != "end") {
let ino = window.prompt("What is your name?");
window.alert("Hello " + ino);}
else {window.alert("go away now mate"); }
}
</script>
</head>
<body onLoad="start()">
<p>Javascript Test Page</p>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire