Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created April 29, 2016 20:23
Show Gist options
  • Save easierbycode/3835fed7e58bec78718f95e071b60d21 to your computer and use it in GitHub Desktop.
Save easierbycode/3835fed7e58bec78718f95e071b60d21 to your computer and use it in GitHub Desktop.
let a = {a:1}, b = {b:2};
let target = {};
// skips non-enumerable properties
Object.defineProperty(b, 'c', {
value: 3,
enumerable: false
});
Object.assign(target, a, b);
console.log( b );
// {b: 2, c: 3}
console.log( target );
// {a: 1, b: 2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment