Last active
March 18, 2019 16:46
-
-
Save joelnet/a793f45a547e4c7a38005e417be2258c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 = ({ password, ...object }) => | |
({ ...object, password }) | |
// -------- | |
// / | |
// move password to last property | |
organize(user3) | |
//=> { name: 'Naboo', id: 300, password: 'Password!' } |
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