-1
我似乎無法訪問由調用函數定義的參數 - myfunction在被調用的函數method2中。任何想法我做錯了什麼。我有一種感覺,我正在陷入我不確定的倒閉之中。Javascript範圍問題在運行時無法訪問變量事件
function myfunction(){
var config = { alpha: 1, beta:2, charlie:3}
$(someelement).on('event', function(a,b,config){
//a and b are published established params of the event im using
//config is something im adding
method2(a, b, config);
});
}
function method2(a,b,c){
//param c is undefined why ??
}