main.js
1
2
3
4
5
6
7
8
9
10
const unsafeOptions = {
  fontSize: 18
};
const defaults = {
  fontSize: 16,
  color: 'black'
};
const options = Object.assign({}, defaults, unsafeOptions);
console.log(options.fontSize); // => 18
console.log(options.color);    // => 'black'
Native Browser JavaScript