logo

Crowdly

Browser

Add to Chrome

Fill in the blank to make the code calculate the sum of the cubes of the numbers...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

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)

0%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on learning.monash.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome