如果把return sum 换成是document.write(sum)
如果把return sum 换成是document.write(sum),
可以吗?
2016-07-12
可以 但后面要加换行 方便看结果
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>返回值函数</title> <script type="text/javascript"> function app2(x,y) { var sum,x,y; sum = x * y; document.write(sum+'<br />'); } var req1 =app2(5,6); var req2 =app2(2,3); </script> </head> <body> </body> </html>
举报