Skip to content

Instantly share code, notes, and snippets.

@ilearnjavascript
Created March 27, 2019 23:23
Show Gist options
  • Save ilearnjavascript/e85503d314e322702d1bf70ae83f34c8 to your computer and use it in GitHub Desktop.
Save ilearnjavascript/e85503d314e322702d1bf70ae83f34c8 to your computer and use it in GitHub Desktop.
es6 - new methods - 14.js
var target = { a: 1, b: 2 };
var source = { b: 4, c: 5 };
var returnedTarget = Object.assign(target, source);
console.log(target);
// outputs: Object { a: 1, b: 4, c: 5 }
console.log(returnedTarget);
// outputs: Object { a: 1, b: 4, c: 5 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment