Created
November 24, 2018 23:01
-
-
Save manekinekko/18554251853ac66361df4b457290e0b3 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 Jedi() {} | |
Jedi.prototype.useForce = function () { | |
console.log('I am using the force!'); | |
}; | |
const anakin = Jedi(); | |
const luke = new Jedi(); | |
console.log(anakin instanceof Jedi); //=> false | |
console.log(typeof anakin.useForce); //=> TypeError: anakin is undefined | |
console.log(luke instanceof Jedi); //=> true | |
console.log(typeof luke.useForce); //=> 'function' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment