3 ms·
The sorting approach to extracting the maximum element seems inefficient, especially as they mention Math.max as the next example. This seems to work, too: Mat
by Tichy 17y ago
The sorting approach to extracting the maximum element seems inefficient, especially as they mention Math.max as the next example. This seems to work, too:
Math.max.apply(Math,[3,5,1,7,9]);
- willwagner 17y agoI was just typing a similar comment when I saw yours. In general, learning how to use "apply" is a very useful technique for someone coming up to speed in Javascript.