Jump to content

Algorithms/Find maximum/java script method 6

From Wikibooks, open books for an open world

<script language="javascript">

 function findMaxFourEle(i_intA,i_intB,i_intC,i_intD) {
    var o_intMax = i_intA;
    if ( i_intB > o_intMax )
       o_intMax = i_intB;
    if ( i_intC > o_intMax )
       o_intMax = i_intC;
    if ( i_intD > o_intMax )
       o_intMax = i_intD;     
    return o_intMax;
 } // end method
 function findMaxThreeEle(i_intA,i_intB,i_intC) {
    return findMaxFourEle(i_intA,i_intB,i_intC,i_intC);    
 } // end method     
 document.write(findMaxThreeEle(3,4,5));
 </script>