ES9 version of jQuery.extend()

Gaurav Gandhi
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"
}

--

--

Gaurav Gandhi

10+ yrs exp. in software dev. Highly versatile and adaptable, learns new tech quickly to deliver top-notch results.