0
0
GGGiovanny Gongora
Calculates the sum of the powers of all the numbers from start to end (both inclusive).
const sumPower = (end: number, power: number = 2, start: number = 1) =>
Array(end + 1 - start)
.fill(0)
.map((x, i) => (i + start) ** power)
.reduce((a, b) => a + b, 0);