Apache
In the folders where your JavaScript files will be served from, create an .htaccess file with the following contents:
| 1 | Header add Access-Control-Allow-Origin "*" | 
Nginx
Add the add_header directive to the location block that serves your JavaScript files:
| 1 | location ~ ^/assets/ { | 
js bind
| 1 | window.name = 'gswin' | 
window.name = ‘gswin’
var geeks = {
name : “ABC”,
printFunc: function(){
 console.log(this.name,this);}
} 
var printFunc2= geeks.printFunc.bind(geeks);
printFunc2();
```