Created
November 24, 2018 23:03
-
-
Save manekinekko/4508491b498e85febed5be0e9970deea 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() { | |
this.useForce = function () { | |
return 'I am the Instance'; | |
}; | |
} | |
// 1) nous créons une instance… | |
const luke = new Jedi(); | |
// 2) … ensuite nous attachons la méthode "useForce" | |
Jedi.prototype.useForce = function () { | |
return 'I am the Prototype'; | |
}; | |
console.log(luke.useForce()); //=> 'I am the Instance' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment