About the Rest Parameter with Function Parameters

((a, b) => a + b, 0);
confused in this part

  **Your code so far**

const sum = (...args) => {
return args.reduce((a, b) => a + b, 0);
}
console.log(sum(1, 2, 3)); 
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

rest operator is used for to overcome problem comes with arguments

for example :

function fun(no1,no2){ 
   let total = 0;
for(let i in arguments){
          total += arguments[i];
   }
return total;
}
fun(10,20);  // output 30

in above example it work fine right , but what if i want my first argument to pass string and other i want some of them
for example

function fun2(str,no1,no2){
           let total = 0 ;
      for(let i in arguments){
      total += arguments[i];
}
return  total;
}
fun1('rio',21,22);  //  here output will be 0rio,21,22 

to overcome above problem i can use rest operator .

example

function fun3(str,...some){
      let total = 0 ;
for(let i in some){
    total += some[i];
}
return total;
}
fun3('rio',20,10,20,30); // here output will be 80 

basically what exaclty rest operator doing here. it says after str parameter i will take all aruments and do what ever you say me .