This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Convert a C floating-point number of type
jsdouble to a
JSBool JS_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval);
||The context in which to create the new number. Requires request. In a
||The numeric value to convert.|
||Out parameter. On success,
The result is an integer
d can be stored that way. Otherwise, a new floating-point
jsval is created.
Some space for the new value may be allocated from the JS garbage collection heap. In this case, the value is subject to garbage collection until you protect against it using a local root, an object property, or the
JS_AddRoot function. This can be avoided by using the address of a rooted variable as
JS_NewNumberValue stores a numeric
*rval and returns
JS_TRUE. Otherwise it returns
JS_FALSE and the value left in
*rval is unspecified.