Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save escottalexander/e66e7b0bd9a705f225145c6fa44062f9 to your computer and use it in GitHub Desktop.
Save escottalexander/e66e7b0bd9a705f225145c6fa44062f9 to your computer and use it in GitHub Desktop.
https://repl.it/@ElliottAlexande/Object-creator-drill-1
https://repl.it/@ElliottAlexande/Object-updater-drill
https://repl.it/@ElliottAlexande/Self-reference-drill
https://repl.it/@ElliottAlexande/Deleting-keys-drill
@Jefftopia
Copy link

https://repl.it/@ElliottAlexande/Object-updater-drill

Nothing wrong with your solution! Here's another nifty way to update or merge objects:

function updateObject(obj) {
  const o = {
    foo: 'foo',
    bar: 'bar',
    bizz: 'bizz',
    bang: 'bang'
  };

  return Object.assign(obj, o);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment