What am I missing in this code? When I try to run it it only gives the first "else if" alert. I cant find anything I have done wrong on Google(c) so I was wondering if the experts can have a look at my code. Is there a text box I need to add?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Compliant Template</title>
<link rel="stylesheet" href="css/style.css">
<script>
var scoops = 5;
if (scoops >= 5) {
alert("Eat faster, the ice cream is going to melt!");
} else if (scoops == 5) {
alert("See a Doctor Now you may have diabeties");
} else if (scoops == 4) {
alert("Bit greedy dont you think");
} else if (scoops == 3) {
alert("Leave some for the other kids");
} else if (scoops == 2) {
alert("Going once!");
} else if (scoops == 1) {
alert("Going twice!");
} else if (scoops == 0) {
alert("Gone!");
} else {
alert("Still lots of ice cream left, come and get it.")
}
</script>
</head>
<body>
</body>
</html>
If I am doing something wrong please alert me.
Thank you Ben Guha