function a() {
if (b.caller == b) {
return 'fun is b';
} else {
return 'other fun';
}
}
function b() {
a(); // return 'fun is b'
}
function c() {
a(); // return 'other fun'
}
b();
c();
注意:'use strict’下无法使用caller
function a() {
if (b.caller == b) {
return 'fun is b';
} else {
return 'other fun';
}
}
function b() {
a(); // return 'fun is b'
}
function c() {
a(); // return 'other fun'
}
b();
c();
注意:'use strict’下无法使用caller