Algorithms/Find maximum/java script method 1
Appearance
<script language="javascript">
function findMax(intA) { if ( intA.length == 0 ) return 0; if ( intA.length == 1 ) return 1; var o_intMax = intA[0]; for (var p_intI = 1; p_intI < intA.length; p_intI++) { if ( intA[p_intI] > o_intMax ) { o_intMax = intA[p_intI]; } // end if } // end loop return o_intMax; } // end method var intA = new Array(1,3,6); document.write(findMax(intA)); </script>