Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step08 #5

Open
pul8219 opened this issue Sep 9, 2020 · 2 comments
Open

step08 #5

pul8219 opened this issue Sep 9, 2020 · 2 comments

Comments

@pul8219
Copy link

pul8219 commented Sep 9, 2020

No description provided.

@pul8219
Copy link
Author

pul8219 commented Sep 9, 2020

마크다운으로 작성하셨군요! 원래도 좋았는데 가독성이 더더 좋아진 것 같아요 step8 잘 읽었습니다 👍
제 결과물에 남겨주신 리뷰보고 형욱님 문서중 Promise 부분도 정독했습니다.

@eyabc
Copy link

eyabc commented Sep 10, 2020

에러에는 문법 에러, 런타임 에러, 논리적 에러가 있디.

  1. 문법 에러
console.log(;
  1. 런타임 에러

    • 배열 인덱스 범위
    • 잘못된 공간에 접근하는 경우
    • 0으로 나누는 것
  2. 논리적 에러

    • 실행시 오류x
    • 원하는 결과가 아닐때

에러의 종류에 대해 공부하신 점이 잘하신것 같아요


constructor 를 통해서 에러를 구분하는 방법도 있군요.

try {
    console.log("잘 실행됩니다.");
    console.log(v);
    console.log("버려짐");
} catch (e) {
    switch (e.constructor) {
        case SyntaxError:
            console.log("안실행");
            break;
        case ReferenceError:
            console.log(e.constructor);
            console.log("실행");
            break;
    }
}

추가적으로 if (e instanceof SyntaxError) 이처럼 instanceof 를 사용하면 SyntaxError 를 상속한 에러도 잡을 수 있는 특징이 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants