For example. I enter 120, 128, and 1.. It will then prompt me to enter the final number which I put 124. Now I have it set as 124 so everything less than 124 it will print. So I want the array to print 124, 120 and 1. Now I just need that in code. I can't seem to figure out what to do and can't find any examples. Any help with examples or anything, I could use. Thank you!
Code so far:
<html>
<title>Homework 5</title>
<body>
<script>
var num = new Array();
var x = 0;
var lastnum;
for (x = 0; x < 3; x++)
{
num[x] = window.prompt("Please enter a number between 100-999:");
if((num[x] < 100) || (num[x] > 999))
{
lastnum = window.prompt("Enter your last number:");
for (x = 0; x < 1; x++)
{
num.sort();
window.alert(num);
}
break;
}
}
window.alert("DONE");
</script>
</body>

New Topic/Question
Reply



MultiQuote




|