1. ## if statements

What would be the proper syntax to find the lowest of 5 user input numbers using IF statements?

2. I used this syntax but the number3 is always identified as largest even when it is not.

//largest
if (number1 > number2 > number3)
largest = number1;
else if (number2 > number1 > number3)
largest = number2;
else
largest=number3

3. You can't do it like that. You can only compare one item to another at a time. You can't compare 3 items to each other.

You can do the logical equivalent by using the and operator (&&) like this:
(the extra parentheses are optional here)
Code:
`if((number1 > number2) && (number1 > number3))`

4. largest= Math.max(number1 , number2 , number3)

or for an array of numbers-

var numberarray=[2,14,3,4,1,7]
var largest= Math.max.apply('',numberarray);

5. ## would this work for five numbers?

thanks for all the help!!!!!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•