JavaScript Global Reference
The JavaScript global properties and functions can be used with all the built-in JavaScript objects.
JavaScript Global Properties
Property | Description |
---|---|
Infinity | A numeric value that represents positive/negative infinity |
NaN | "Not-a-Number" value |
undefined | Indicates that a variable has not been assigned a value |
JavaScript Global Functions
Function | Description |
---|---|
decodeURI() | Decodes a URI |
decodeURIComponent() | Decodes a URI component |
encodeURI() | Encodes a URI |
encodeURIComponent() | Encodes a URI component |
escape() | Deprecated in version 1.5. Use encodeURI() or encodeURIComponent() instead |
eval() | Evaluates a string and executes it as if it was script code |
isFinite() | Determines whether a value is a finite, legal number |
isNaN() | Determines whether a value is an illegal number |
Number() | Converts an object's value to a number |
parseFloat() | Parses a string and returns a floating point number |
parseInt() | Parses a string and returns an integer |
String() | Converts an object's value to a string |
unescape() | Deprecated in version 1.5. Use decodeURI() or decodeURIComponent() instead |
Functions or Methods?
It makes sense to call the list above global functions rather than global methods because the functions are called globally and not any objects.
Anyway, you can also call these functions methods, since they are methods of the global object where they run. In a web browser, the global object is the browser window. Then isNaN() is actually a window method: window.isNaN().