Solución
solution.tsTypeScript
export function sumFirstOdds(n: number): number {
// Create an array with N length and fill it with odd numbers (2 * index + 1), then do total sum
return Array.from({ length: n }, (_, i) => 2 * i + 1).reduce((total, current) => total + current, 0)
}0respuestas