I want to remove the user_id field from 2 different objects but get a compile error. what is the correct way ?
const { user_id, ...userLessId } = user
const { user_id, ...zombieLessId } = existingZombieUser
You have to assign these variables to different names, otherwise your user_id will be defined twice, which cause an SyntaxError.
const { user_id: user_id1, ...userLessId } = user
const { user_id: user_id2, ...zombieLessId } = existingZombieUser
You have to avoid the SyntaxError, so you can also reassign just one variable:
const { user_id, ...userLessId } = user;
const { user_id: zombieUserId, ...zombieLessId } = existingZombieUser;