MoreLesson 233Free preview
Remove Property
This lesson is part of How To · All levels
Summary
Deleting properties from JavaScript objects can be done with the delete operator, e.g. delete user.email. This operator deletes the property of the object itself, not the property of the prototype. If you want to create a new object without a specific property without changing the original object, use rest destructuring.
Key points
- Delete object.property delete property from object
- Delete returns true unless property cannot be deleted
- Delete does not delete the inherited property from the prototype
- Rest destructuring produces new copies without changing the original object
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.