Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Understanding The Global Object

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 121
    Comment on it

    The global object is a JavaScript's regular object that serves as a very important purpose: the properties of this object are the globally defined symbols that are available to a JavaScript program. When the JavaScript execution starts, it creates a new global object and gives it an initial set of properties that define:

     global properties like undefined, Infinity, and NaN
     global functions like isNaN(), parseInt(), and eval().
     constructor functions like Date(), RegExp(), String(), Object(), and Array()
     global objects like Math and JSON
    

    You can use JavaScript keyword "this" to refer to the global object:

    var global = this; // Define a global variable to refer to the global object
    

    In client-side JavaScript, the Window object serves as the global object for all JavaScript code contained in the browser window it represents. This global Window object has a self-referential window property that can be used instead of this to refer to the global object. The Window object defines the core global properties, but it also defines quite a few other globals that are specific to web browsers and client-side JavaScript.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: