js 创建函数,传递三个参数,返回最大值

//练习:创建函数getMax,传递3个参数,返回三个数字中的最大值。
function getMax3(a,b,c){
if(a>b && a>c){
return a;
}else if(b>a && b>c){
return b;
}else{
return c;
}
}
console.log('最大值为: '+getMax3(15,2,36));
*/

/*
function getMax3(a,b,c){
var max=a>b ? a : b;
return max>c ? max : c;
}
var max=getMax3(3,2,7);
console.log(max);

原文地址:https://www.cnblogs.com/Mr-Chao1791/p/10696778.html