28 lines
347 B
JavaScript
28 lines
347 B
JavaScript
|
function A(){
|
||
|
|
||
|
}
|
||
|
A.prototype.foo = function foo_of_A(){
|
||
|
console.log("foo_of_A");
|
||
|
}
|
||
|
|
||
|
function B(){
|
||
|
|
||
|
}
|
||
|
B.prototype.foo = function foo_of_B(){
|
||
|
console.log("foo_of_B");
|
||
|
}
|
||
|
|
||
|
function test1(){
|
||
|
var a = new A
|
||
|
console.log("calling foo_of_A");
|
||
|
a.foo()
|
||
|
}
|
||
|
|
||
|
function test2(){
|
||
|
var b = new B
|
||
|
console.log("calling foo_of_B");
|
||
|
b.foo()
|
||
|
}
|
||
|
|
||
|
test1()
|
||
|
test2()
|