Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

This article needs a technical review. How you can help.

Convert a JS ID to a JS value.

Syntax

bool
JS_IdToValue(JSContext *cx, jsid id, JS::MutableHandle<JS::Value> vp);
Name Type Description
cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
id jsid The property identifier to convert.
vp JS::MutableHandle<JS::Value> Out parameter. On success, *vp receives the converted value.

Description

JS_IdToValue converts a specified JS ID, id, to a JS value. On success, JS_IdToValue stores the converted value in *vp and returns true. Otherwise it returns false.

The inverse of JS_IdToValue is JS_ValueToId.

See Also

Document Tags and Contributors

 Contributors to this page: kscarfone, arai, fscholz, Jorend, Dria, MMondor, Nickolay, Tservo
 Last updated by: kscarfone,