Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- k1: `111`,
- k2: `222`,
- k3: `333`
- };
- const renameProp = (oldProp, newProp, {[oldProp]:old, ...others}) => ({
- [newProp]: old,
- ...others
- })
- console.log(renameProp('k1', 'kx', old_obj))
- console.log(old_obj)
Add Comment
Please, Sign In to add comment