HQccc
2019-12-19 16:18
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>if...else</title><script type="text/JavaScript">var sum=0;for(var money=1;money<=10;money++;){ sum=money+sun} document.write('sum')</script></head><body></body></html>
<script type="text/JavaScript"> var sum=0; for(var money=1;money<=10;money++){ sum=money+sum; } document.write(sum); </script>
for循环money++后不加分号
变量名要保持一致 - sum
输出变量不加引号
JavaScript进阶篇
468060 学习 · 21891 问题
相似问题