如果我有以下设置:
function entryPoint (someVariable) {
getValue(arg)
.then(anotherFunction)
}
function anotherFunction (arg1) {
}
我怎样才能制作someVariable
可用于anotherFunction
?
最佳答案
你可以试试这个。
function entryPoint (someVariable) {
getValue(arg)
.then(anotherFunction(someVariable))
}
function anotherFunction(someVariable) {
return function(arg1) {
}
}
关于javascript - 在 ES6 中,如何将额外的参数传递给 .then() 调用中的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34981293/