Appendix D. JavaScript Global Functions

Several global functions are also available to your programs. Most of these involve parsing strings for some purpose, and several of them are for preparing strings for use as URIs. See Chapter 6: The Global and Object Objects for more explanation of these functions.

Table D.1. List of Methods

Method Name

Support

Description

decodeURI()

CH1+, FF1+, IE5.5+, NN4+, O3+, SF1+

Returns the unencoded value of an encoded Uniform Resource Identifier (URI) string.

decodeURIComponent()

CH1+, FF1+, IE5.5+, NN4+, O3+, SF1+

Returns the unencoded value of an encoded component of a Uniform Resource Identifier (URI) string.

encodeURI()

CH1+, FF1+, IE5.5+, NN4+, O3+, SF1+

Encodes a text string to a valid Uniform Resource Identifier (URI) by encoding reserved characters.

encodeURIComponent()

CH1+, FF1+, IE5.5+, NN4+, O3+, SF1+

Encodes a text string to a valid component of a Uniform Resource Identifier (URI) by encoding reserved characters.

escape()

CH1+, FF1+, IE3+, NN2+, O3+, SF1+

Encodes a string by replacing all special or reserved characters with their encoded equivalents. escape() is not Unicode-safe.

eval()

CH1+, FF1+, IE3+, NN2+, O3+, SF1+

Evaluates JavaScript source code and then executes it.

isFinite()

CH1+, FF1+, IE4+, NN4+, O3+, SF1+

Returns a Boolean value indicating if the supplied number is finite.

isNaN()

CH1+, FF1+, IE3+, NN2+, O3+, SF1+

Determines if the passed value will be treated as a number or not.

parseFloat()

CH1+, FF1+, IE3+, NN2+, O3+, SF1+

Returns a floating point ...

Get JavaScript® Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.