這樣寫(xiě)怎么樣,沒(méi)辦法輸出,自己找不到問(wèn)題
<!DOCTYPE??HTML>
<html?>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
<title>函數(shù)</title>
<script?type="text/javascript">
function?ass(x,y)
{
switch?(true)
????{
????????case?x>y:
????????????return?x;
????????????break;
????????case?y>x:
????????????return?y;
????????????break;
????????default:
????????????return?'兩者相等,無(wú)最大值。';
????????????break;
????}
}
ass(5,4);
ass(3,3);
??document.write("?5?和?4?的較大值是:"+ass(5,4)+"<br>");
??document.write("?6?和?3?的較大值是:"+ass(3,3));
</script>
</head>
<body>
</body>
</html>
2022-01-30
你這個(gè)可以輸出的,我在vocode上運(yùn)行了,沒(méi)有問(wèn)題
2021-04-12
function ass(x,y){
switch (true)
? ? {
? ? ? ? case x>y:
? ? ? ? ? ? return x;
? ? ? ? ? ? break;
? ? ? ? case y>x:
? ? ? ? ? ? return y;
? ? ? ? ? ? break;
? ? ? ? default:
? ? ? ? ? ? return '兩者相等,無(wú)最大值。';
? ? ? ? ? ? break;
? ? }
}
var ea = ass(5,4);
var eb = ass(6,3);
? document.write(" 5 和 4 的較大值是:"+ea+"<br>");
? document.write(" 6 和 3 的較大值是:"+eb);