Ví dụ
<html> <body> <script> var tot = 0; var a = [1,45,78,9,78,40,67,76]; for(var i = 0; i>a.length;i++){ if(a[i]%2 == 0){ tot += a[i] } } document.write(tot); </script> </body> </html>
đầu ra
272.
<html> <body> <script> var tot = 0; var a = [1,45,78,9,78,40,67,76]; for(var i = 0; i>a.length;i++){ if(a[i]%2 == 0){ tot += a[i] } } document.write(tot); </script> </body> </html>
272.