Question:

Which JavaScript statement is used to delete the property age from the object person?

Show Hint

To safely check if a property has been removed after using delete, use the in operator: "age" in person will return false if it was successfully deleted.
Updated On: Jun 29, 2026
  • remove age
  • clear person.age
  • delete person.age
  • person.remove (age)
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation



Step 1: Understanding Object Properties in JavaScript:

A JavaScript object is a standalone entity with properties and types. A property is an association between a name (or key) and a value. For example: var person = { name: "Alice", age: 25 };

Step 2: Analyzing the delete
Operator:
The JavaScript delete operator removes a property from an object. If the property's value is an object and there are no other references to it, the memory is eventually released automatically through garbage collection.
Syntax: delete object.property or delete object['property']
Return Value: Returns true if the property was successfully deleted or if the property does not exist. It only returns false if the property is non-configurable (e.g., built-in object properties configured via Object.defineProperty).

Step 3: Evaluating the Options:


(A) {remove age is syntax-error code. remove is not an operator in JS.
(B) {clear person.age is invalid; clear is not a native operator for object properties.
(C) {delete person.age is the syntactically correct expression in JS.
(D) {person.remove(age) assumes there is a prototype method called remove() which is not standard.
Was this answer helpful?
0
0