Your Search Results

    JS DeleteElement2

    Remove a specified numeric property from an object.


    JSBool JS_DeleteElement2(JSContext *cx, JSObject *obj,
        jsint index, jsval *rval);
    Name Type Description
    cx JSContext * The context in which to delete the property. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
    obj JSObject * The object from which to delete the property.
    index jsint Index of the property to delete.
    rval jsval * Out parameter. On success, *rval receives JSVAL_FALSE if the property was not deleted because it is permanent and JSVAL_TRUE otherwise.


    JS_DeleteElement2 removes a specified numeric property, index, from an object, obj. If rval is non-null, the final stored value of the deleted property is stored in *rval. If obj inherits the specified property from a prototype, the property is removed from the object, but not from the prototype. If deletion is successful, JS_DeleteElement2 returns JS_TRUE. Otherwise it returns JS_FALSE.


    Per the ECMA standard, JS_DeleteElement2 removes read-only properties from objects as long as they are not also permanent.

    For JavaScript 1.2 and earlier, if deletion fails because the property is permanent, JS_DeleteElement2 reports the error and returns JS_FALSE. For JavaScript 1.3, the attempt is silently ignored. In both these cases, *rval will receive the stored value of the property that was not deleted.

    To remove all properties from an object, call JS_ClearScope.

    See Also

    MXR ID Search for JS_DeleteElement2

    JS_DefineElement, JS_DeleteElement, JS_GetArrayLength, JS_GetElement, JS_IsArrayObject, JS_LookupElement, JS_NewArrayObject, JS_SetArrayLength, JS_SetElement

    Document Tags and Contributors

    Contributors to this page: Jorend
    Last updated by: Jorend,