MDN’s new design is in Beta! A sneak peek:

Obsolete since JSAPI 32
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.

Determine if a given jsval is a JavaScript number.




JSVAL_IS_NUMBER(v) is true if v is a JavaScript number.

To convert a numeric jsval to a C floating-point number, use JS_ValueToNumber.


The following code snippet illustrates how a JavaScript variable, MyItem, is conditionally tested in an if statement to see if it is a JS integer or double value.

if (JSVAL_IS_NUMBER(MyItem)) {

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, Jorend, Jminta, alecananian
 Last updated by: arai,