This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run it in Browser | |
function thisInBrowser() { | |
console.log(this === window); // true | |
} | |
thisInBrowser(); | |
//Run it in Node.js | |
function thisInNodeJS() { | |
console.log(this === global); // true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slang = 'Kongu'; | |
function printSlang() { | |
console.log(this.slang); // Kongu | |
} | |
printSlang(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (exports, require, module, __filename, __dirname) { | |
//****Your code starts here****// | |
var city = 'Karur'; | |
console.log(this.city); // undefined | |
console.log(city); //Karur | |
//****Your code ends here****// | |
}); | |
var args = [self.exports, require, self, filename, dirname]; | |
return compiledWrapper.apply(self.exports, args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var city = 'Karur'; | |
console.log(this.city); // Karur | |
console.log(city); //Karur |
NewerOlder