javaScript Global Object

javascript global object an intrinsic object whose purpose is to collect global functions and constants into one object.it is defined in the ecma-262 standard to be a place for globally accessible, otherwise homeless properties to reside.

note: you cannot create an instance of the global object.

note - the global object methods and constants can be used freely anywhere in your scripts without global perfix.

var     str   =  "http:\\google.com?\t\r\"my  name \' is \t  ram \\ \n";
                
var     str2  =  'all\"\t\f\r';
                
document.write("<br/>"+"encode the string value_______"+encodeuri(str));
                
document.write("<br/>"+"encode the second string_____"+decodeuri(str2));
                
document.write("<br/>"+"is not a number____"+isNaN('hello'));
                
document.write("<br/>"+"is not a number_____"+isNaN(1.23));
                
document.write("<br/>"+"is value is infinity___"+isFinite(0/12));

JavaScript - global object properties

propertydescription
infinityconstant holding the numeric value infinity
naN"not-a-Number" value
undefinedindicates that a variables has not been assigned a value

JavaScript - global object methods

methoddescription
escape()encodes a string
unescape()decodes an encoded string
decodeuri()decodes a uniform resource identifier (uri)
decodeuricomponent()decodes a uri component
encodeuri()encodes a uri
encodeuricomponent()encodes a uri component
eval()takes a string and executes if as javaScript code
isFinite()determines whether a value is a infinity
isNaN()determines whether a value is an illegal number
number()converts an object's value to a number
parseInt()parse a string and returns an integer
parseFloat()parse a string and returns a floating point number