CrackTheAir

06-02-2009, 09:19 PM

Hi all.

I used the function Math.max() to find the maximum number in a series of numbers. However, after it finds that number, I want it to say a specific thing if it is a certain number. Here's the code:

var h = Math.max(a,b,c,d,e,f,g)

if (h==2){

h=="Two"

alert(h)

}

However, when the maximum does turn out to be 2, it alerts ("2") instead of ("Two"). I've also tried this:

var h = Math.max(a,b,c,d,e,f,g)

var l = "string"

if (h==2){

l=="Two"

alert(l)

}

But on the alert, it comes back as "string". What's wrong here and what can I do to make this work?

I used the function Math.max() to find the maximum number in a series of numbers. However, after it finds that number, I want it to say a specific thing if it is a certain number. Here's the code:

var h = Math.max(a,b,c,d,e,f,g)

if (h==2){

h=="Two"

alert(h)

}

However, when the maximum does turn out to be 2, it alerts ("2") instead of ("Two"). I've also tried this:

var h = Math.max(a,b,c,d,e,f,g)

var l = "string"

if (h==2){

l=="Two"

alert(l)

}

But on the alert, it comes back as "string". What's wrong here and what can I do to make this work?