JavaScript: Create/Delete Property
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:
obj.k = v
[see Property Dot Notation / Bracket Notation]- Reflect.set
- Reflect.defineProperty
- Object.defineProperty
- Object.defineProperties