Languages
[Edit]
EN

JavaScript - remove object from associative array

0 points
Created by:
Jacob
532

In this article, we would like to show you how to remove an object from an associative array in JavaScript.

By associative arrays in JavaScript, we can mean objects because they map keys (properties) to values.

To remove a property from an object in JavaScript, use the delete operator.

Practical example

Edit

In this example, we use the delete operator to remove name property from user object.

Note:
When delete operator is applied to an index property of an Array, it will create an array with a missing index.

Note:

The delete operator doesn't directly free the memory.

References

Edit
  1. delete operator - JavaScript | MDN
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join