How to Remove a Property from a JavaScript Object

Written by Ubaidullah| JS

In this tutorial, you’ll learn to remove a property from a JavaScript object.

Table of Contents

  1. Simple example
  2. Working with complex objects
  3. Remove a specific index from object’s array property
  4. Video Tutorial & Demo

Simple Example

Let’s say you have an object as follows:

Now let’s say again, you want to remove the property hugh to make the object like this:

For this, we are going to use delete.

OR


Working with complex objects

Suppose, you have a complex object like:

Remove an entire property

If you want to remove the entire twentyseventeen, do this like:

OR


Remove a specific index from object’s array property

If you want to delete a single twentysixteen movie and you know the index, then:

Do an index search if you don’t know the index:


Video Tutorial & Demo

I hope this JavaScript’s object manipulation guide helps you to understand how things work.

How to Remove a Property from a JavaScript Object
Rate this post

Last modified: June 2, 2017

Leave a Reply

Your email address will not be published. Required fields are marked *