Last active
August 29, 2015 14:24
-
-
Save grvgl/b31b8324d8eec9984401 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
var JavaScriptSuperClass = function(count){ | |
this.count = count; | |
}; | |
JavaScriptSuperClass.prototype.increase = function(){ | |
this.count++; | |
}; | |
var JavaScriptSubClass = function(count){ | |
JavaScriptSuperClass.call(this, count); | |
}; | |
JavaScriptSubClass.prototype = Object.create(JavaScriptSuperClass.prototype); | |
JavaScriptSubClass.prototype.constructor = JavaScriptSubClass; | |
JavaScriptSubClass.prototype.decrease = function(){ | |
this.count--; | |
}; | |
var obj = new JavaScriptSubClass(10); | |
console.log(obj.constructor); //functin JavaScriptSubClass(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment