題目連結
Beginner Series #3 Sum of Numbers
解法
function getSum(a, b)
{
const start = Math.min(a, b);
const end = Math.max(a, b);
let sum = 0;
for (let i = start; i <= end; i++) {
sum += i;
}
return sum;
}
心得
先找出最大和最小值
再利用迴圈一個一個加起來

![[筆記]TCL 01 -初學者](https://static.coderbridge.com/images/covers/default-post-cover-2.jpg)
