快捷导航

结果为什么会报undefined?

//求三个数的最大值functiongetnum2(a,b,c){if(a>b){if(a>c){returna;}}elseif(b>c){returnb;}elsereturnc;}console.log("三个数的最大值为:"+getnum2(1000,200,3000));

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员2

if判断的分支不完整
function getnum2(a, b, c) {  
                        if (a > b) {
                                if( a > c){ return a }
                                else{ return c }
                        }
                        else{
                                if(b>c){return b}
                                else{return c }
                        }
回复

使用道具 举报

你的a>b分支语句块内没有,关于a
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP