Created
November 24, 2018 23:09
-
-
Save manekinekko/d468cb3ef06505556b138198f8b92d91 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() {} | |
Jedi.prototype.toString = function () { | |
return 'I am the Force'; | |
}; | |
function Jedi() {} | |
Jedi.prototype = Force.prototype; | |
Jedi.prototype.toString = function () { | |
return 'I am a Jedi'; | |
}; | |
const luke = new Jedi(); | |
const force = new Force(); | |
console.log(luke instanceof Jedi); //=> true | |
console.log(luke instanceof Force); //=> true | |
console.log(luke + ''); //=> 'I am a Jedi' | |
console.log(force + ''); //=> 'I am a Jedi' <=== OH OH !!!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment