トピックに関するさまざまな紹介文を読んだことがありますが、詳細はまだ分かりません(nodejs内)。asyncの詳細/ typescriptでの待ち受け
async function a() {
const e = await Promise.resolve(42);
console.log(e);
return e;
}
const b = a();
console.log(b);
ディスプレイ
Promise { <pending> }
42
BとEは同じではないため説明は何ですか?削除した後に私は得る
Promise { 42 }
Promise { <pending> }
再び同じではありません。 eの初期化の右側を平易な数字42に置き換えると、もう一つの約束が得られます
42
Promise { 42 }
説明できますか?
ありがとう! 3つの答えはすべて良いです。 – bollin