ABOUT ME

만나서 반가워요!! SMASMC Blog 입니다. 기술 노트로 사용중인 Blog입니다. # 소통해요.

Today
Yesterday
Total
  • Promise (프로미스)
    NodeJS (NestJS) 2024. 1. 12. 03:21
    const condition = true;
    
    const promise =new Promise((resolve,reject)=>{
        if(condition){
            resolve('success');
        }else{
            reject('fail');
        }
    });
    
    promise.then((message)=>{
        console.log(message);
    }).catch((error)=>{
        console.error(error);
    }).finally(()=>{
        console.log('Promise의 비동기 작업을 마쳤을 경우 실행');
    });

    'NodeJS (NestJS)' 카테고리의 다른 글

    NodeJS package manage  (0) 2024.02.20
Designed by Tistory.