Last active
March 18, 2019 16:46
-
-
Save joelnet/0bdc3ea258ad0ddf12ebead62a808b0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const user3 = { | |
password: 'Password!', | |
name: 'Naboo', | |
id: 300 | |
} | |
const organize = object => ({ id: undefined, ...object }) | |
// ------------- | |
// / | |
// move id to the first property | |
organize(user3) | |
//=> { id: 300, password: 'Password!', name: 'Naboo' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is written for 7 Tricks with Resting and Spreading JavaScript Objects