blob: 8edc527127641363775815f1e74bdf6e98616559 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
function C() {
this.foo = 'bar';
}
C.prototype.bar = function() {
return 41;
};
function D() {
C.call(this);
this.baz = 'bat';
}
D.prototype = Object.create(C.prototype);
D.prototype.bar = function() {
return C.prototype.bar.call(this) + 1;
};
function fn() {
var d = new D();
return d.bar();
}
assertEqual(fn(), 42);
test(fn);
|