Rest Parameter in js

Tell us what’s happening:
Don’t understand the Rest Parameter at all and there is no explanation of this parameter and there is no good explanation of this parameter in the lesson

  **Your code so far**

const sum = (x, y, z) => {
const args = [x, y, z];
return args.reduce((a, b) => a + b, 0);
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

With rest parameters you don’t have to have a fix number of parameters like the above sum function. In that it has 3 parameters x, y, z. However, if you have a rest parameter even if the function call has 3, 4 or how many parameters you can deal with it without worrying about how many parameters are there. And since the rest parameter is an array you can use filter, map and reduce array functions on it.

Example :

squareIt(2, 5, 10, 12);
squareIt(3,5,8,15,7,4);

squareIt = (…args)=> {
return args.map((a)=>a*a));
}

See this demo code here.