Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save manekinekko/458501ca5b5992d9b870ccb2e25003f5 to your computer and use it in GitHub Desktop.
Save manekinekko/458501ca5b5992d9b870ccb2e25003f5 to your computer and use it in GitHub Desktop.
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