sum = x * y; //return sum; // alert(sum) } var moust = app2(2,8)
document.write(moust);
怎么 document.write(moust);这一句中要用变量名称,,二不用sum
逸风4241167
浏览 1305回答 1
1回答
a14562
function app2(x,y) { sum = x * y; //return sum; // alert(sum) } var moust = app2(2,8)document.write(moust);这段代码运行后是undefined,如果想正常显示需要return sum;因为在return sum后,调用app2这个方法会返回sum值赋值给moust、