function throw_(x){
if(x<0){
throw new Error("x不能為負數")
}else{
for (var f=1;x>1;f*=x,x--){
document.write(f+"<br/>")
}
}
}
try{
var n=Number(prompt("請輸入一個正整數",""));
var f=throw_(n);
document.write(f);
alert(n + " = " +f);
}
為什么計算到我輸出的那個數字的時候f回事undefined
SMILET
2018-12-06 21:23:59