我無法通過所有參數。我的承諾回調只接收一個而不是三個:javascript承諾不通過所有參數(使用Q)
var asyncFunction= function(resolve) {
setTimeout(function() {
resolve("Some string that is passed", "and another", "third");
}, 1000);
};
var promiseFunction = function() {
var deferred = Q.defer();
asyncFunction(deferred.resolve);
return deferred.promise;
};
promiseFunction().then(function() {
// Only one argument is passed here instead of 3
// { '0': 'Some string that is passed' }
console.log(arguments);
});
任何想法我做錯了什麼?
我的錢是強制類型 –