Rest & Spread: Summary Calculator | Sololearn: Learn to code for FREE!

+1

Rest & Spread: Summary Calculator

You are making a program to calculate the sum of any number of values. Complete the given function so that it takes as parameters as many numbers as needed and returns the sum. // I want to understand this, but no luck after 30 + minutes. Please help. https://code.sololearn.com/cT4Xmj400fpV/?ref=app

2/16/2022 1:15:17 AM

Tahiti🌍Castillo

2 Answers

New Answer

+2

In your code, 'rest' variable is already an array. No need to initialize it again. We just need to run a for loop over the rest array, add all the items and return the final sum. That's it. 👍

+2

Morpheus ! I’ve been waiting to see you here. Thank you for that advice, and I will try it! 🙏