function doSth(){
abc('a, b, c', function(){ // 回调函数
return result;
})
return ???// 怎样将上面回调函数的值在这里作为主调函数的返回值
}
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
难以确定你的回调函数的触发时机。
如果是异步的就用promise
同步的就在外层定义一个命名空间。let result;
这样 result的作用域就被提升到了doSth中