- Global Properties of undefined, Infinity and NaN
- Global Functions like NaN(), parseInt() and eval()
- Constructor Functions like Date(), RegExp(), String(), Object() and Array()
- Global Objects like Math and JSON
This window object is referenced using window property instead of this to refer the global object.
The URI encode method encodes the URI so that it is acceptable to the browser, by replacing all invalid characters with the special UTF-8 encoding .
The Difference is that, encodeURI() works on entire URL, while encodeURIComponent() works solely on a segment of URI (say any illegal values.)
The counter to above methods are the, decodeURI() and decodeURIComponent() methods are available.
The method decodeURI() method decodes characters encoded by encodeURI(), while decodeURIComponent() decodes characters encoded by encodeURIComponent()
In the below demo, the global variable Slogan and the global Function shoutSlogan() are defined , the variable is accessed using window object , and then the function is called of the window object.