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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.