JavaScript中的for循環
for迴圈
格式:
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> var sum = 0; for(var i=1;i<=100;i++){ if(i%10==0){ sum+=i; } } document.write("100以内能被10整除的数之和为:"+sum) </script> </head> <body> </body> </html>