Yes, you just have to provide a default value for the complete argument:
function myFunction({option1 = true, option2 = 'whatever'} = {}) {
// ^^^^
console.log(option1, option2);
// do something...
}
More Related Contents:
- One-liner to take some properties from object in ES 6
- What is destructuring assignment and its uses?
- Where can I get info on the object parameter syntax for JavaScript functions?
- Is it possible to destructure onto an existing object? (Javascript ES6)
- What does curly brackets in the `var { … } = …` statements do?
- ES6/ES2015 object destructuring and changing target variable
- How do I destructure all properties into the current scope/closure in ES2015?
- ES6 destructuring function parameter – naming root object
- How to destructure object properties with key names that are invalid variable names?
- Destructuring in Node.JS
- Destructuring and rename property
- ES6 Destructuring and Module imports
- Destructuring Nested objects in javascript | Destructure second level parent and child Objects
- ES6 destructuring object assignment function parameter default value
- Curly brackets (braces) in Node.js ‘require’ statement
- Node JS / V8 destructuring bug?
- How to bind methods when destructuring an object in JavaScript?
- object destructuring: how to use intermediate nested property
- setState doesn’t update the state immediately
- Does ES6 introduce a well-defined order of enumeration for object properties?
- Private properties in JavaScript ES6 classes
- Why can I change a constant object in javascript
- Defer execution for ES6 Template Literals
- ECMAScript 6 features available in Node.js 0.12
- Do I need require js when I use babel?
- Can I use arrow function in constructor of a react component?
- setState() inside of componentDidUpdate()
- Destructuring deep properties
- “unexpected token import” in Nodejs5 and babel?
- How to get the target of a JavaScript Proxy?