View Full Version : Need Help with a javascript program to find the max of 10 values

12-10-2009, 08:54 PM
My assignment was to write a javascript program to find the max of 10 values. I have attached the code file of my work and i need someone to check it to see why its not working the way i need it too!! Thanks!! :) :D

12-10-2009, 10:18 PM
We do not do homework. Ask a specific question.

12-11-2009, 03:08 AM
Well, we will help with homework if you've obviously made an effort, which your code shows that you have. The main problem is that here:

input1 = window.prompt("Enter your 10 numbers" , "0" );

input1 is a string and before you compare it to max1 which (at least originally) is a number, nothing is done to convert it to a number. So here:

if(input1 > max1)

comparison is performed on the basis of alphabetizing.