es6 default parameters object destructuring code example
Example 1: js object destructuring with defaults
const { dogName = 'snickers' } = { dogName: undefined }
console.log(dogName)
const { dogName = 'snickers' } = { dogName: null }
console.log(dogName)
const { dogName = 'snickers' } = { dogName: false }
console.log(dogName)
const { dogName = 'snickers' } = { dogName: 0 }
console.log(dogName)
Example 2: object destructuring default value
let a, b;
[a=5, b=7] = [1];
console.log(a);
console.log(b);