TypeError: "x" has no properties
null
과 undefined
라는 속성에 접근하려고 시도할때 "null(혹은 undefined)은 속성이 없습니다"라는 JavaScript 에러가 발생합니다.
메세지
TypeError: Cannot read properties of undefined (reading 'x') (V8-based) TypeError: null has no properties (Firefox) TypeError: undefined has no properties (Firefox) TypeError: undefined is not an object (evaluating 'undefined.x') (Safari)
에러 타입
무엇이 잘못되었을까?
예제
>null and undefined have no properties
js
null.foo;
// TypeError: null has no properties
undefined.bar;
// TypeError: undefined has no properties