MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
Your Search Results

    JS_GetOwnPropertyDescriptor

    This article is in need of a technical review.

    Introduced in JavaScript 31

    Get a detailed description of that property.

    Syntax

    bool
    JS_GetOwnPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char *name,
                                JS::MutableHandle<JSPropertyDescriptor> desc);
    
    bool
    JS_GetOwnPropertyDescriptorById(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
                                    JS::MutableHandle<JSPropertyDescriptor> desc);
    
    bool
    JS_GetOwnUCPropertyDescriptor(JSContext *cx, JS::HandleObject obj, const char16_t *name,
                                  JS::MutableHandle<jspropertydescriptor> desc); // Added in SpiderMonkey 45
    </jspropertydescriptor>
    Name Type Description
    cx JSContext * A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
    obj JS::HandleObject The object to search for the property.
    id const char * or JS::HandleId or const char16_t The name of the property to look up.
    desc JS::MutableHandle<JSPropertyDescriptor> Out parameter. On success, if no property is found, desc->obj is set to NULL. If a property is found, *desc receives a description of it.

    Description

    JS_GetOwnPropertyDescriptor and JS_GetOwnPropertyDescriptorById get a detailed description of that property (returned in desc->obj). If desc->obj is null, then this property was not found on the prototype chain.

    See Also

    Document Tags and Contributors

    Contributors to this page: Sheppy, kscarfone, markg, arai
    Last updated by: arai,
    Hide Sidebar