Adding and Removing Object Properties
You can add properties to an object in JavaScript using dot notation or bracket notation. Here's an example using dot notation:
Loading Code . . .
You can remove properties from an object using the delete
keyword:
Loading Code . . .
Challenge Time!
Create a function called addProperty
that takes two arguments: an object and a key. The function should add a new property to the object with a value of null
. The function should return the object.
Then, create a function called removeProperty
that takes two arguments: an object and a key. The function should remove the property from the object. The function should return the object.
Loading...