JavaScript: Create/Delete Property

By Xah Lee. Date: . Last updated: .

Create Property When Object is Created

Properties can be created at the same time when you create a object. There are 2 ways:

Add Property

New properties can be added to a existing object. If the property already exist, it's modified. Here's the ways:

Delete Property

  1. delete obj[key] [see Delete operator]
  2. Reflect.deleteProperty(obj, key) [see Reflect.deleteProperty]

JavaScript Property

BUY
Ξ£JS
JavaScript in Depth

JavaScript in Depth

Basic Syntax

Value Types

Variable

String

Property

Object and Inheritance

Array

Function

Constructor/Class

Iterable 🌟

Misc