The window object exposes the functionality of the web browser to the webpage. The window object exposes the browser’s functionality If you don’t want to pollute the window object, you can use the let keyword to declare variables and functions. Var showCounter = () => console.log(counter) īecause the counter variable and the showCounter() function are declared globally with the var keyword, they are automatically added to the window object. It means that all variables and functions declared globally with the var keyword become the properties and methods of the window object. The global object of JavaScript in the web browser is the window object. Summary: in this tutorial, you will learn about the JavaScript window object which is the global object of JavaScript in the browser and exposes the browser’s functionality.
0 Comments
Leave a Reply. |