JSVAL_IS_STRING

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.

Determines if a given jsval is a string.

Syntax

JSVAL_IS_STRING(v)

Description

JSVAL_IS_STRING(v) is true if v is a string.

To access the content of a string jsval, use JSVAL_TO_STRING, JS_GetStringChars, and JS_GetStringLength.

Example

The following code snippet illustrates how a JavaScript variable, MyItem, is conditionally tested in an if statement to see if it is a string.

if (JSVAL_IS_STRING(MyItem)) {
    ...
}

See Also