异步方法的callback只支持返回一个参数
jianggaocheng opened this issue · 1 comments
jianggaocheng commented
const test = function(name, callback) {
setTimeout(function() {
callback('123', '456');
}, 10);
}
在回调里面只接收到了‘123’,接收不到‘456’
andot commented
是的,callback的那个参数就是返回值,你要返回多个值,可用数组,比如:
callback(['123', '456']);