Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.25 KB | None
  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
RAW Paste Data Copied
Advertisement