L
L
lssssssssssl2021-07-21 21:29:05
JavaScript
lssssssssssl, 2021-07-21 21:29:05

How to delete an object property?

60f866fc0a48d465955476.png
Not deleted :(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aetae, 2021-07-21
@lsssssssssl

Well, it's probably not configurable .
Recreate the object:

const {password, ...rest} = user;
console.log(password);
console.log(rest);
return rest;

M
M0OL0L, 2021-07-21
@M0OL0L

delete deletes only its own properties and does not delete inherited ones, to delete an inherited property of an object, you need to delete it in the prototype of the object in which it is defined.
delete cannot remove non-custom properties.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question