麻烦大家看看我的代码为什么结果是6
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>if...else</title> <script type="text/JavaScript"> var mymoney,sum=0;//mymoney变量存放不同面值,sum总计 for(mymoney=1;mymoney==1||mymoney==2||mymoney==3||mymoney==10||mymoney==12;mymoney++) { sum= sum + mymoney; } document.write("sum合计:"+sum); </script> </head> <body> </body> </html>
sum的结果不应该是1+2+3+10+12吗,为什么是1+2+3=6呢