Last active
March 15, 2019 18:08
-
-
Save silent-lad/671100888972592cdcb5478716e80e05 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
function Preposition(name_init) { | |
this.name = name_init; | |
this.displayName = function() { | |
console.log(`Preposition is ${this.name}`); | |
} | |
} | |
let these = new Preposition("these"); | |
these.displayName(); // Prints Preposition is these | |
let those = new Preposition("those"); | |
those.displayName(); // Prints Preposition is those | |
let thoseDisplay = these.displayName.bind(those); // Creates new function with value of “this” equals to "those" object | |
thoseDisplay(); // Prints:- Preposition is those |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment