Algorithms/Find maximum/java script method 5
Appearance
<script language="javascript">
function sorting(i_intaryTb) { var p_blnFound = true; while ( p_blnFound ) { p_blnFound = false; for ( var p_intI = 0; p_intI < (i_intaryTb.length - 1) ; p_intI += 1) { if ( i_intaryTb[p_intI] > i_intaryTb[p_intI + 1] ) { var intTmp = i_intaryTb[p_intI]; i_intaryTb[p_intI ] = i_intaryTb[p_intI+1]; i_intaryTb[p_intI + 1] = intTmp; p_blnFound = true; } // end if } // end loop } // end while return i_intaryTb; } // end function function findMax(i_intaryTb) { i_intaryTb = sorting(i_intaryTb); return i_intaryTb[i_intaryTb.length - 1]; } // end method var cc = new Array(3,40,5); document.write(findMax(cc)); </script>