JS DeleteProperty
From MDC
Removes a specified property from an object.
[edit] Syntax
JSBool JS_DeleteProperty(JSContext *cx, JSObject *obj, const char *name);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
Pointer to a JS context from which to derive runtime information.
Requires request. (In a |
obj |
JSObject * |
Object from which to delete a property. |
name |
const char * |
Name of the property to delete. |
[edit] Description
JS_DeleteProperty removes a specified property, name, from an object, obj. If an object references a property belonging to a prototype, the property reference is removed from the object, but the prototype's property is not deleted. If deletion is successful, JS_DeleteProperty returns JS_TRUE. Otherwise it returns JS_FALSE.
[edit] Notes
Per the ECMA standard, JS_DeleteProperty removes read-only properties from objects as long as those properties are not also permanent.
For JavaScript 1.2 and earlier, if failure occurs because you attempt to delete a permanent property, JS_DeleteProperty reports the error before returning JS_FALSE. For JavaScript 1.3, the attempt is silently ignored.
To remove all properties from an object, call JS_ClearScope.