In the following example, is there a way to construct the object such that “b” has a property a1, initialised to “2”?
function A(a1) {
this.a1 = a1;
}
function B(b1, a1) {
this.b1 = b1;
}
B.prototype = new A;
var b = new B('1', '2');
I am basically trying to duplicate what would be known as “calling the base constructor” in a traditional object orientated language (such as c#).
Like this?