Say, I have an object:
const user = {_id: 1234, firstName: 'John', lastName: 'Smith'}
I want to create another object without the _id
key:
const newUser = {firstName: 'John', lastName: 'Smith'}
I am using this:
const newUser = Object.assign({}, {firstName: user.firstName, lastName: user.lastName})
Is there a better way to do this?