gpt4 book ai didi

javascript - 在 ES6 中,如何将额外的参数传递给 .then() 调用中的函数?

转载 作者:行者123 更新时间:2023-11-27 23:25:43 28 4
gpt4 key购买 nike

如果我有以下设置:

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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com