JS::ToUint32

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

This article covers features introduced in SpiderMonkey 17

Convert any JavaScript value to an unsigned 32bit integer.

Syntax

bool
JS::ToUint32(JSContext *cx, JS::HandleValue v, uint32_t *out);
Name Type Description
cx JSContext * The context in which to perform the conversion. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
v JS::HandleValue The value to convert.
out uint32_t * Out parameter. On success, *out receives the converted floating-point value.

Description

JS::ToInt32 converts a JavaScript value to an unsigned 32bit integer. It implements the ToInt32 operator described in ECMA 262-3 §9.6.

On success, JS::ToInt32 stores the converted value in *out and returns true. On error or exception, it returns false, and the value left in *out is undefined.

See Also

Document Tags and Contributors

 Contributors to this page: kscarfone, arai
 Last updated by: kscarfone,