Null vs. Undefined
null과 undefined 둘중 하나를 확인
// null과 undefined는 `==`를 사용해도 일치합니다.
console.log(null == null) // true (of course)
console.log(undefined == undefined) // true (of course)
console.log(null == undefined) // true
// 다음과 같은 경우는 false값을 반환합니다.
console.log(0 == undefined) // false
console.log('' == undefined) // false
console.log(false == undefined) // falsefunction foo(arg: string | null | undefined) {
if (arg != null) {
// arg must be a string as `!=` rules out both null and undefined.
}
}최상단에서 undefined 확인
undefined는 명시적으로 사용하는 걸 제한해야 합니다.
undefined는 명시적으로 사용하는 걸 제한해야 합니다.노드 방식 콜백
undefined를 유효성을 나타내는 수단으로 사용하지 마십시요.
undefined를 유효성을 나타내는 수단으로 사용하지 마십시요.JSON 그리고 serialization
결론
Last updated