js function that takes 3 numbers and return max value code example
Example 1: js maximum number value
Number.MAX_VALUE;
Example 2: 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));
Example 3: How to get maximum value in Javascript
let x = Math.max(1,3,45,59,698);
console.log(x);