Created
November 24, 2018 23:06
-
-
Save manekinekko/458501ca5b5992d9b870ccb2e25003f5 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 = { | |
useForce: Force.prototype.useForce | |
}; | |
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); //=> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment