🔰destructuring arguments

🚧 under construction -> merge

JSoperatorassignmentdestructuring ⟩ arguments

👉 See: object destructuring for more info.

const {log} = console;

// function parameter by object destructuring
function f ({
  hi = 2,         // default param
  ...options      // other params as an object ⭐️
}={}) {

  log(options);   
  return hi;      
}

// test run
f({x: 1, y: 2, hi: 3});      // 3
// options = { x: 1, y: 2 }

Last updated