저자는 기타 고려사항 이라지만, 내 입장에선 왜 이제서야 알려주나 하는 생각이 들며, 중요했던 글입니다.
일반 OOP에서 class의 constructor가 void이거나 무시되는 것처럼...
https://javascript.info/async-await
async function f() {
return 1;
}
f().then(alert); // 1
===
async function f() {
return Promise.resolve(1);
}
f().then(alert); // 1
,
async function f() {
await Promise.reject(new Error("Whoops!"));
}
===
async function f() {
throw new Error("Whoops!");
}
https://developpaper.com/question/how-to-pass-multiple-parameters-in-resolve-in-js-es6-promise/
resolve() can only accept and process one parameter. Extra parameters will be ignored. That’s what spec says.
With array wrap, you can transfer multiple parameters, but the result of resolve is naturally an array.