Answers for "js function that takes 3 numbers and return max value"

0

js function that takes 3 numbers and return max value

function max_of_three(x, y, z) 
 {
  max_val = 0;
  if (x > y)
  {
    max_val = x;
  } else
  {
    max_val = y;
  }
  if (z > max_val) 
  {
    max_val = z;
  }
  return max_val;
}

console.log(max_of_three(1,0,1));
console.log(max_of_three(0,-10,-20));
console.log(max_of_three(1000,510,440));
Posted by: Guest on March-26-2021

Code answers related to "js function that takes 3 numbers and return max value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language