Modify the function `sum`

using the rest parameter in such a way that the function `sum`

is able to take any number of arguments and return their sum.

The result of `sum(0,1,2)`

should be 3

Passed

The result of `sum(1,2,3,4)`

should be 10

The result of `sum(5)`

should be 5

The result of `sum()`

should be 0

The `sum`

function should use the `...`

rest parameter on the `args`

parameter.

const sum = (x, y, z) => {

const args = [x, y, z];

return args.reduce((a, b) => a + b, 4);

}

console.log(sum(0,1, 2));

console.log(sum(1, 2, 3));

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36`

.

**Challenge:** Use the Rest Parameter with Function Parameters

**Link to the challenge:**

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters