Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function restParam(parameter1, ...restArgs){
- console.log(restArgs.length); // Logs the number of arguments that do not have a corresponding parameter
- console.log(restArgs[2]); // Logs the 3rd argument after the number of arguments that do not have a corresponding parameter
- }
- restParam(1,2,3,4,5);
- // Log would be as follows
- // 4
- // 4
- // 4 is the number of arguments that do not have a corresponding parameter
- // 4 is the 4th 3rd argument after the number of arguments that do not have a corresponding parameter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement