javascript Sum of a sequence code example
Example: javascript Sum of a sequence
const sequenceSum = (begin, end, step) => {
let sum = 0
for (let i = begin; i <= end; i += step) sum += i;
return sum
};
console.log(sequenceSum(2, 6, 2))
const sequenceSum = (begin, end, step) => {
let sum = 0
for (let i = begin; i <= end; i += step) sum += i;
return sum
};
console.log(sequenceSum(2, 6, 2))