views:

119

answers:

2

I also need to convert my answer into javascript code that displays the largest value.

A: 

I guess you just need something on the lines of:

var mx = list[0];
for (i=1; i<length(list); i++)
    mx = Math.max(mx, list[i])

alert(mx)
nico
Alternatively, `Math.max.apply(null, list)`
CD Sanchez
@Daniel: good one! Did not know about the apply function
nico
+3  A: 
alert(Math.max(13, 42, 86, 3, 25)); // 86
BoltClock