-
-
Save ellereeeee/18db5581c12ed804bff703cbda103607 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
name = "GLOBAL OBJECT NAME"; | |
function greet (name) { | |
return `Hi ${name}, my name is ${this.name}!` | |
} | |
var bob = { | |
name: 'Bob', | |
greet: greet | |
} | |
bob.greet('Jane'); // Hi Jane, my name is Bob! | |
var greetFn = bob.greet; // this binding is lost! | |
greetFn('Jane'); // // Hi Bob, my name is GLOBAL OBJECT NAME! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment