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

2 answers 192 views
1 answer 148 views
1 answer 143 views
2 answers 147 views
1 answer 155 views
...