typeof null; // object
null instanceof Object; // false
null은 어떤 값이 '비어있음(absense)'을 나타낸다.
primitive value 이며 falsy 한 값으로 취급된다.
https://262.ecma-international.org/5.1/#sec-11.4.3
ECMAScript Language Specification - ECMA-262 Edition 5.1
This section contains a non-normative overview of the ECMAScript language. ECMAScript is an object-oriented programming language for performing computations and manipulating computational objects within a host environment. ECMAScript as defined here is not
262.ecma-international.org
Javascript confusing syntax inconsistence for null, instanceof and typeof?
var obj = {}; typeof obj; // returns "object" obj instanceof Object // return true typeof null // returns "object" null instanceof Object // returns false And how about typeof undefined // retu...
stackoverflow.com
'과거' 카테고리의 다른 글
성능 최적화 (0) | 2021.09.06 |
---|---|
[JS] Object property order (0) | 2021.07.13 |
details marker 제거 (0) | 2021.07.13 |
이벤트 리스너, 이벤트 위임 (0) | 2021.07.13 |
[JS] Lexical Grammar, Language Element (0) | 2021.07.05 |