Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function restParam(parameter1, ...restArgs){
  2. console.log(restArgs.length); // Logs the number of arguments that do not have a corresponding parameter
  3. console.log(restArgs[2]); // Logs the 3rd argument after the number of arguments that do not have a corresponding parameter
  4. }
  5.  
  6. restParam(1,2,3,4,5);
  7. // Log would be as follows
  8. // 4
  9. // 4
  10.  
  11. // 4 is the number of arguments that do not have a corresponding parameter
  12. // 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