并沒有輸出結果呀,只有個空的輸入框顯示,為什么?
function com(a,b)
//定義函數
{
if (a>b){
?return a;
}
else if (a<b){
? ? return b;
}
else{
? ? return ("兩值一樣大");
}
//函數體,判斷兩個整數比較的三種情況
}
? document.write(" 5 和 4 的較大值是:"+com(5,4)"<br>");
? document.write(" 6 和 3 的較大值是:"+com(6,3)+"<br>");?
? document.write(" 7 和 7的較大值是:"+com(7,7));
//調用函數,實現下面兩組數中,返回較大值
2016-03-01
函數com(5,4)不應該在""中,還有就是return ("兩值一樣大"),返回的是個字符串,不應該有括號
2016-02-29
格式錯誤?
else{
? ? return "兩值一樣大";
}
2016-02-29
同問!!