본문 바로가기
Today I learned

2020 10 21

by soheemon 2020. 10. 21.

optional catch binding in javascript

ES2019에 도입된 optional catch binding 문법을 사용하면 오류 개체를 저장하기 위해 변수를 사용할 필요가 없다.
즉 catch이후 ()괄호를 제거할 수 있다.

*유일하게 IE! 에서 만! 지원하지 않으므로 유의한다..

// optional catch binding
try{
}catch{
}

// standard
try{
}catch(e){
}

 

참고[https://www.tutorialspoint.com/explain-optional-catch-binding-in-javascript]
참고2[https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/try...catch]

'Today I learned' 카테고리의 다른 글

2020 10 25  (0) 2020.10.25
2020 10 24  (0) 2020.10.24
2020 10 16  (0) 2020.10.16
2020 10 14  (0) 2020.10.14
2020 10 13  (0) 2020.10.13

댓글