我有功能A
,它定义了另一个函数B
。 B作为argument
传递给另一功能C
至handle event
供以后使用。功能B need data
从function A
。是否有可能以这种方式传递数据?从外部函数传递数据在内部函数中供以后使用
function A(B){
var o = [1,2,3];
B = function() {
alert(this.blio); // data from A blio is undefined
};
B.blio = o; //bind data in property to B
$('selector').C({ result: B}); //handle event
}
当您尝试时,是什么行为? –
在函数B中,this.blio是未定义的。 – TheChampp
调用“B()”的代码是什么? –