delete
Remove an item from an object. Use the delete
operator on the key to remove.
let lunch = {
sandwich: 'turkey',
chips: 'cape cod',
drink: 'soda'
};
// Remove the chips key from the lunch object
delete lunch.chips;
// logs {sandwich: 'turkey', drink: 'soda'}
console.log(lunch);
⏰ Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.
Find this useful? You can support my work by purchasing an annual membership.