Rest parameters in JavaScript


Rest parameters

 The rest parameter syntax allows a function to accept an indefinite number of arguments as an array.

 Only the last parameter in a function definition can be a rest parameter.


function first(firtstar,...argments){

    console.log(firtstar,argments);

}

first(1,3,3,4,5);


Output::1 [ 3, 3, 4, 5 ]

Comments

Popular posts from this blog

My Sql Query ..

Interview question laravel.