0
const sequenceSum = (begin, end) => {
// BEGIN (write your solution here)
if (begin === end) {
return end;
} else if (begin > end) {
return NaN;
}
return end + sequenceSum(end-1);
// END
};
export default sequenceSum;
你好。我不明白上述代碼的問題。我有以下錯誤:遞歸JavaScript問題
RangeError: Maximum call stack size exceeded
看起來像遞歸永不止步。你究竟如何稱呼這個函數? – str
http://xyproblem.info/ –