Rest Parameters in JavaScript Functions
Easy
7
87.5% Acceptance
In this lab, you will learn how to use rest parameters in JavaScript functions. Rest parameters are useful when you want to accept an arbitrary number of arguments in a function. They are represented by three dots (...
) followed by the name of the array that will hold the values.
Your task is to create a sumAll
function that accepts rest parameters and calculates the sum of all passed numbers. Make sure to export the function to run the tests. The lab uses ESM exports
NOTE: Rest Paramenters are not to be confused with Spread Operator they are different functionalities that share the same syntax.