为啥不同位置不一样的结果呢
<script type="text/JavaScript">
var mymoney,sum=0;//mymoney变量存放不同面值,sum总计
for(mymoney=1;mymoney<=10;mymoney++)
{
//sum=sum+mymoney;
document.write("sum合计:"+sum);
sum=sum+mymoney;
}
document.write("sum合计:"+sum);
</script>
<script type="text/JavaScript">
var mymoney,sum=0;//mymoney变量存放不同面值,sum总计
for(mymoney=1;mymoney<=10;mymoney++)
{
//sum=sum+mymoney;
document.write("sum合计:"+sum);
sum=sum+mymoney;
}
document.write("sum合计:"+sum);
</script>
2018-07-25
举报