|
|
|
Topic |
global object functions in javascript?
|
|
Explanation |
Object: Global
Global object is defined to associate an object with globally accessible variables
and functions defined in previous versions of javascript. Global object method can be used or referenced directly.
The below table lists the methods that are available in global objects
| Method | Example Code | Result | Description |
| escape(string) |
escape("test val"); |
| escape(string) method converts the special characters like space, colon etc
of the given string in to escape sequences.
|
| eval(expression) |
eval(2*(3+5)); |
| eval method evaluates a regular expression and returns the result.
|
| isFinite(number) |
isFinite(234455); |
| isFinite(number) method returns true if the number is finite, else false.
|
| isNaN(value) |
isNaN(23); |
| isNaN function validate the argument for a number and returns true
if the given value is not a number else
returns false.
|
| unescape(string) |
unescape("test%20val"); |
| unescape(string); function replaces the escape sequences with original values.
%20 is the escape sequence for space " ".
|
Thus the global object functions can be used to evaluate a regular expression (eval), validate a number (isNaN), handle
escape characters, etc..
|
Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script.
Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.
|
|
|
|