javascript对象问题
我试图模仿mongodb map reducejavascript对象问题,javascript,jquery,Javascript,Jquery,我试图模仿mongodb map reduce function some_function(){ .... call_some (some_object); .... } function call_some (some_object){ // In here, // How could I use this keyword instead of some_object? // some_object.something => this.
function some_function(){
....
call_some (some_object);
....
}
function call_some (some_object){
// In here,
// How could I use this keyword instead of some_object?
// some_object.something => this.something
}
在javascript或jquery中,使用的调用 或者,如果您不想以特殊方式调用它,请尝试以下方法:
function call_some(some_object) {
if(this !== some_object) {
return call_some.apply(some_object, arguments);
}
// do something interesting here
// this === some_object
}
function call_some(some_object) {
if(this !== some_object) {
return call_some.apply(some_object, arguments);
}
// do something interesting here
// this === some_object
}