Enea Xharja

Remove a property from an object

Remove a property from an object using the rest operator (ES6):

const user = {
  name: 'Enea',
  age: 99,
  jsMaster: true,

const { jsMaster, ...updatedUser } = user;

console.log(updatedUser); // {name: "Enea", age: 99}
console.log(user); // {name: "Enea", age: 99, jsMaster: true}

Updated on January 06, 2021

Tagged with: javascript, snippets

Profile picture

Hey there! I'm Enea, a Web Developer at wohnvoll in Berlin. Welcome to my little corner of the web, where I share my personal collection of notes, code snippets, and resources on topics that interest me.

© 2022 Enea Xharja