Mozilla.com

Table of contents
  1. 1. Syntax
  2. 2. Description
  3. 3. Example
Table of contents
  1. 1. Syntax
  2. 2. Description
  3. 3. Example

Determine if a given jsval is a JavaScript number.

Syntax

JSVAL_IS_NUMBER(v)

Description

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.

Example

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)) {
    ...
}

LXR ID Search for JSVAL_IS_NUMBER

Page last modified 20:11, 5 Sep 2008 by Jorend

Files (0)