7. The Global Object

In Chapter 5, you learned that all functions execute in a context that you can refer to with the this keyword. A simple function executed normally runs in the global context. In a browser, the global object is window.


When you learned about variable scope in Chapter 5, you learned that variables outside of functions are in the global scope. In fact, declaring a variable in the global scope is the same as making a property on the global object.


In Chapter 2, you learned about a few global functions such as isNaN() and parseInt() ...

Get The JavaScript PocketGuide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.