Skip to content

Instantly share code, notes, and snippets.

@joelnet
Last active March 18, 2019 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelnet/a793f45a547e4c7a38005e417be2258c to your computer and use it in GitHub Desktop.
Save joelnet/a793f45a547e4c7a38005e417be2258c to your computer and use it in GitHub Desktop.
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!' }
@joelnet
Copy link
Author

joelnet commented Mar 18, 2019

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