본문 바로가기
✘✘✘ Javascript/Typescript

Non-Null assertion:: exclamation mark (!) after variable. 변수 뒤 ! 느낌표

by PrettyLog 2023. 4. 8.

The exclamation mark (!) is the non-null assertion operator in TypeScript. It tells the compiler that we are sure that the value returned by document.getElementById('root') is not null or undefined.

const dom = document.getElementById('root')! // dom is not null

댓글