0

匿名関数の戻り値を引数として別の関数hello1()に渡す必要があります

hello1 = function(x,m) { console.log(m) };

return $(this).each(function() {
        var self = this;
        hello1(something , function(){ return(this); });
});

console.log(m)を実行すると、... return(this);が表示されます。オブジェクトの代わりに

4

2 に答える 2

2

mは関数であるため、その結果を取得するには、mを呼び出す必要があります。

hello1 = function(x,m) { console.log(m()) };
于 2012-04-22T04:42:53.293 に答える
0

なぜあなたはただ「自己」を渡すことができないのですか?

hello1 = function(x,m) { console.log(m) }; 

return $(this).each(function() { 
        var self = this; 
        hello1(something , self }); 
}); 
于 2012-04-22T04:42:36.580 に答える