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 249 views
2 answers 312 views
1 answer 244 views
1 answer 237 views
2 answers 259 views
...