프로그래밍/JavaScript
[JavaScript] undefined, null 체크
Gooding
2023. 5. 24. 20:57
728x90
반응형
undefined 체크
if (typeof str === 'undefined') {...}
null 체크
if (str === null) {...}
값 존재 여부 체크
if (typeof str === 'undefined' || str === null || str === '') {
// 값이 없는 경우 실행될 코드
}
반응형