Last active
May 26, 2019 14:38
-
-
Save prmishra/48a1333f5161f97d97ab4df23e9af106 to your computer and use it in GitHub Desktop.
This file contains 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 args = process.argv.slice(2); | |
var hero = { | |
name: args[0], | |
getSecretIdentity: function (){ | |
return this.name; | |
} | |
}; | |
var stoleSecretIdentity = hero.getSecretIdentity; | |
console.log(stoleSecretIdentity()); | |
console.log(hero.getSecretIdentity()); | |
// node script.js bruce-wayne |
var args = process.argv.slice(2);
var hero = {
name: args[0],
getSecretIdentity: function() {
return this.name;
}
};
var stoleSecretIdentity = hero.getSecretIdentity.bind(hero);
console.log(stoleSecretIdentity());
console.log(hero.getSecretIdentity());
var args = process.argv.slice(2);
var hero = {
name: args[0],
getSecretIdentity: function (){
return this.name;
}
};
var stoleSecretIdentity = hero.getSecretIdentity.bind(hero);
console.log(stoleSecretIdentity());
console.log(hero.getSecretIdentity());
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var args = process.argv.slice(2);
var hero = {
name: args[0],
getSecretIdentity: function (){
return this.name;
}
};
var stoleSecretIdentity = hero.getSecretIdentity.bind(hero);
console.log(stoleSecretIdentity());
console.log(hero.getSecretIdentity());
// node script.js bruce-wayne