Let\'s say I have the following code snippet.
function test(id) { alert(id); }
testChild.prototype = new test();
function testChild(){}
var instance = new
JS OOP ...
// parent class
var Test = function(id) {
console.log(id);
};
// child class
var TestChild = function(id) {
Test.call(this, id); // call parent constructor
};
// extend from parent class prototype
TestChild.prototype = Object.create(Test.prototype); // keeps the proto clean
TestChild.prototype.constructor = TestChild; // repair the inherited constructor
// end-use
var instance = new TestChild('foo');