I am using this type of code for inheritance. The problem is i am getting error when set up prototype of B, because new A() tries to access params.param and params is undefined when setting up B.prototype. How to deal with it? Or i should use another style for simulating inheritance in js?
function A(params) {
this.param = params.param; // this will throw error when set up B prototype
}
function B(params) {
A.call(this, params); // this is ok
}
B.prototype = new A(); // this is bad, A need some parameters