✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Fill in the blank to make the code calculate the sum of the cubes of the numbers from 1 to 3 (i.e., 1³ + 2³ + 3³).
function sumTo(n, f = x => x) {
return n ? f(n) + sumTo(n-1, f) : 0;
}
const sumOfCubes = sumTo(3, _______________);
// sumOfCubes should be 36 (1 + 8 + 27)