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 170 views
2 answers 209 views
1 answer 165 views
1 answer 159 views
2 answers 159 views
...