Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function foo({from = 0, to = 100, foo = 'bar', optional} = {}) {
  2.   console.log(from, to, foo, optional);
  3. }
  4.  
  5. foo();
  6. // 0, 100, "bar", undefined
  7.  
  8. foo({from: 99});
  9. // 99, 100, "bar", undefined
  10.  
  11. foo({optional: 'awwyis'});
  12. // 0, 100, "bar"; "awwyis"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement