Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript copy some fields from object

const user = { _id: 1234, firstName: 'John', lastName: 'Smith' };
const { _id, ...newUser } = user;
console.debug(newUser); 
 Run code snippet
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #copy #fields #object
ADD COMMENT
Topic
Name
9+9 =