I lost this bet and don't know why
Heres the deal ........
I made a bet with a friend that I could write a working javaScript that asked the user for 2 numbers and then displayed the sum, differance, product and quotient of the 2 integers. Its a very easy script but the catch was I had to add quotes for readability and get it done in 3 minutes or less.
I got it done in less then 3 minutes but I still lost the bet because, for some reason it didn't work and now that I have paid my losers wages to my mate I'm trying to debug this thing and as easy of a script that it is ...... I can't see what I did wrong.
Its blowing my mind, so here is my script ........... WHATS WRONG WITH IT??? :confused:
Code:
<html>
<head>
<title>Quick JavaScript</title>
<script type = "text/javascript">
var firstNumber, //first string entered by user
secondNumber, //second string entered by user
number1, //first number to use
number2, //second number to use
sum, //sum of number1 and number2
product, //product of number1 and number2
differance, //differance of number1 and number2
quotient; //quotient of number1 and number2
//read first number from user as a string
firstNumber = window.prompt("Enter first integer", "0");
//read second number from user as a string
secondNumber = window.prompt("Enter second integer", "0");
//converts numbers from strings to integers
number1 = parseInt(firstNumber);
number2 = parseInt(secondNumber);
//performs operations
sum = number1 + number2;
product = number1 * number2;
differance = number1 - number2;
quotient = number1 / number2;
//displays output of operations
document.writeln("The sum of " + number1 "and " + number2 + "is " + sum);
document.writeln("The product of " + number1 "and " + number2 + "is " + product);
document.writeln("The differance of " + number1 "and " + number2 + "is " + differance);
document.writeln("The quotient of " + number1 "and " + number2 + "is " + quotient);
</script>
</head>
<body>
</body>
</html>
The prompt windows doesn't even come up so it is something in that part of the script.
I know it is probably something blatantly obvious, but my eyes aren't catching it, maybe someone heres eyes will - Im dumbfounded.