Skip to content

Instantly share code, notes, and snippets.

@joelnet
Last active March 21, 2019 10:38
Show Gist options
  • Save joelnet/dd2de9e1544758b7bcf08648ea2bcbd9 to your computer and use it in GitHub Desktop.
Save joelnet/dd2de9e1544758b7bcf08648ea2bcbd9 to your computer and use it in GitHub Desktop.

Revisions

  1. joelnet revised this gist Mar 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rest-spread-tricks-03b.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    const partial = { id: 100, name: 'Howard Moon' }
    const user = { ...partial, ...{ id: 100, password: 'Password!' } }
    const user = { ...partial, id: 100, password: 'Password!' }

    user //=> { id: 100, name: 'Howard Moon', password: 'Password!' }
  2. joelnet created this gist Mar 1, 2019.
    4 changes: 4 additions & 0 deletions rest-spread-tricks-03b.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    const partial = { id: 100, name: 'Howard Moon' }
    const user = { ...partial, ...{ id: 100, password: 'Password!' } }

    user //=> { id: 100, name: 'Howard Moon', password: 'Password!' }