Created
November 24, 2018 23:07
-
-
Save manekinekko/e3019b9eacc48ce3c4c0127cf523a9c9 to your computer and use it in GitHub Desktop.
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 Force() {} | |
Force.prototype.useForce = function () { | |
return 'I am the Force to be used.'; | |
}; | |
function Jedi() {} | |
Jedi.prototype = new Force(); | |
const luke = new Jedi(); | |
console.log(luke.useForce()); //=> 'I am the Force to be used.' | |
console.log(luke instanceof Jedi); //=> true | |
console.log(luke instanceof Force); //=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment