if の後の return は抜けるけどその後の then句 には突入する
https://nodejs.org/ja/docs/guides/timers-in-node/
test();
async function test() {
await test2().then((r) => {
if(r == "111") return;
console.log(r);
return;
}).then((r) => {
setTimeout(myFunc, 1500, 'funky');
console.log("222");
return;
}).then(() => {
console.log("333");
return;
})
console.log("444");
return;
}
async function test2() {
const a = "111";
return a;
}
function myFunc(arg) {
console.log("1.5秒後経過");
console.log(`arg was => ${arg}`);
}
222
333
444
1.5秒経過
arg was => funky
( ´∀`)<オワリ