<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// 求 1 + 2
// 累加法
var sum = 0;
for (var i = 0; i <= 100; i++) {
sum += i
}
console.log(sum);
// 累乘法
var num = 1;
for (var s = 1; s <= 10; s++) {
num *= s
}
console.log(num);
// 累乘法
var arr = 1;
for (var j = 10; j >= 1; j--) {
arr *= j
}
console.log(arr);
</script>
</body>
</html>
效果图