练习1:求一个数字的阶乘 function getJieCheng(num) { var result = 1; for (var i = 1; i <= num; i++) { result *= i; } return result; } console.log(getJieCheng(6)); //1*2*3*4*5*6 练习2:求一个数字的阶乘和 ps: 5的阶乘和:即5的阶乘+4的阶乘+3的阶乘+2的阶乘+1的阶乘 function getJieChengSum(num) { var…
练习1:求两个数字的和:获取任意的两个数字的和 function getSum(x, y) { return x + y; } console.log(getSum(10, 20)); 练习2:求1-100之间所有的数字的和 function geteverySum() { var sum = 0; for (var i = 1; i <= 100; i++) { sum += i; } return sum; } console.log(geteverySum()); 练习3:求1-n之间所有…