ES9 version of jQuery.extend()
1 min readJul 24, 2019
Neatest and Cleanest implementation of jQuery.extend() in ES9 JavaSciprt
const defaultConfig = {
align: "left",
label: "submit",
animate: true,
color: "#b2ebf2",
background: "#455a64"
};
const userConfig = {
align: "right",
animate: false,
label: "Okay",
border: 'unset',
};
const config = { ...defaultConfig, ...userConfig };
Resulting properties of config
{
"align": "right",
"label": "Okay",
"animate": false,
"color": "#b2ebf2",
"background": "#455a64",
"border": "unset"
}