Skip to content

Instantly share code, notes, and snippets.

@artizirk
Created April 22, 2016 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artizirk/e6678b3ba81a0563b7834b95db286acf to your computer and use it in GitHub Desktop.
Save artizirk/e6678b3ba81a0563b7834b95db286acf to your computer and use it in GitHub Desktop.
javascript prototype objects test
function Obj() {
console.log("obj init");
this.bs();
}
Obj.prototype.bs = function() {
console.log("this is bs");
};
var obj = new Obj();
function T8() {
console.log("T8 init");
this.bs();
this.fe();
}
T8.prototype = Object.create(Obj.prototype);
T8.prototype.fe = function() {
console.log("fe");
};
var t8 = new T8();
t8.fe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment