Let’s say I have an options variable and I want to set some default value.
What’s is the benefit / drawback of these two alternatives?
Using object spread
options = {...optionsDefault, ...options};
Or using Object.assign
options = Object.assign({}, optionsDefault, options);
This is the commit that made me wonder.
here: https://github.com/tc39/proposal-obje...
spread defines properties, whilst Object.assign() sets them: http://2ality.com/2016/10/rest-spread...