Skip to content

Instantly share code, notes, and snippets.

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