The Rest Operator
the Rest operator is written like Spread operator
Spread is value in arrays and objects,
Rest is an argument of function.

Rest is actually , "all the rest of the parameters"

Rest is the best way to send many arguments to function from an array.


        //when the function is defined with rest
        function myFunc(...Arguments){          
            console.log(Arguments);
        }

        //and called with many arguments
        myFunc(1,2,3,4,5,6,7,8,9);              

        //it will return
        [1,2,3,4,5,6,7,8,9]                     
        //an array of all the arguments
    
back to main page