Skip to content

Instantly share code, notes, and snippets.

@nebiros
Created February 9, 2015 15:09
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 nebiros/ecec33aac29d28641217 to your computer and use it in GitHub Desktop.
Save nebiros/ecec33aac29d28641217 to your computer and use it in GitHub Desktop.
function Hi(msg) {
this.msg = msg;
}
Hi.prototype = {
constructor: Hi,
say: function (msg) {
return this.msg + " " + msg;
}
}
function MyHi() {}
MyHi.prototype = new Hi();
MyHi.prototype.constructor = MyHi;
var hi = new MyHi();
console.log(hi.say("hola")); // undefined hola
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment