← #8 Use string literals for the TypeScript enum values
#9

Remove a property from an object

Topics: JavaScript

We can use the ES6 spread operator to remove a property from an object:

const { name, ...rest } = { name: 'Foo', age: 20 };

console.log(name); // 'Foo'
console.log(rest); // { age: '20' }

It's also possible to remove a dynamic property:

const property = 'name';
const { [property]: value, ...rest } = { name: 'Foo', age: 20 };

console.log(value); // 'Foo'
console.log(rest); // { age: '20' }
Fix a typo or suggest an improvement
#10 Always pass the radix to parseInt