function getMyFunction(data) {
return() => new Promise((resolve, reject) => {
resolve('here is the value:', data);
});
}
const myFunction = getMyFunction('a');
Promise.all([
myFunction,
]).then((result) => {
console.log('result: ', result);
});
を呼び出す私はを期待していますが、私が代わりにresult: [ [Function] ]
を取得します。
const myFunction = getMyFunction('a');
Promise.all([
myFunction(), // <-- note here
]).then((result) => {
console.log('result: ', result);
});
'決意が( 'ここでの値です:'、データ)'決意を一つだけ引数を取るが、もう一つは無視されます。 – Thomas
そして、なぜあなたはその行動を期待していますか?あなたが使用した名前で言えば、プロミスではなく、関数を扱っていることに気付いています。それでは、どうやってこの期待をしていますか? – Thomas