obj destructure with default values

by Abdul Ahmad

JavaScript

const state = {};
const { old = {}, newS = {}, newS: { errors } = { errors: [] } } = state;
console.log('old', old);
console.log('new', newS);
console.log('errors', errors);