How to use this in global context with JavaScript

1 Answer

0 votes
console.log(this === window); // the window object is global object

this.s = "javascript";
console.log(window.s) 
console.log(s)        



/*
run:

true
javascript
javascript

*/

 



answered Nov 20, 2020 by avibootz

Related questions

1 answer 167 views
2 answers 206 views
1 answer 159 views
1 answer 151 views
2 answers 157 views
...