DEV Community

Discussion on: Improve your JS skills with those tips #2

Collapse
matheusgoncalves profile image
Matheus Goncalves

I understand the objective and the reasoning behind the suggestions, but we shouldn't be totally against the usage of delete.

It can still be useful in situations where you absolutely need to remove a property from an object before an operation, and the object will no longer be used after this operation.

In this case, personally it seems to be a lot more straightforward than the functional approach you've described. Thoughts?

Collapse
codeoz profile image
CodeOz Author

If you absolutely need to remove a property from an object before an operation and the object will no longer be used after this operation. Why don't use a new object that will no have this property instead of delete it from the original object? If you have any things that depend on this property you will create bug and side effects! If you create a new one, you will not :D