728x90 반응형 async await (try-catch)1 promise - catch / async await (try-catch) ⚠️ 콘솔은 리액트로 찍음..! 동기 function test(value: number) { if (!value) throw new Error('someError'); return value; } const caller = () => { const func = test(1); console.log('func', func); const func2 = test(); console.log('func2', func2); }; caller(); func2는 인자를 아예 넣어주지 않았더니 fun2 밑으론 실행이 안되어서 콘솔이 찍히지 않는다 try-catch 사용시 function test(value: number) { if (!value) throw new Error('someError'); return valu.. 2023. 2. 28. 이전 1 다음 728x90 반응형