Javascript Function Creation Find the Maximum of Three Values

Description

Javascript Function Creation Find the Maximum of Three Values

let value1 = 1;//  ww  w . j  a  v  a  2s  . c  o  m
let value2 = 2;
let value3 = 3;

let maxValue = maximum( value1, value2, value3 );

console.log( "First number: " + value1 +
   "\nSecond number: " + value2 +
   "\nThird number: " + value3 +
   "\nMaximum is: " + maxValue );

// maximum function definition
function maximum( x, y, z )               
{                                         
   return Math.max( x, Math.max( y, z ) );
} // end function maximum                                         



PreviousNext

Related