diff options
Diffstat (limited to 'files/ko/web/javascript/reference/global_objects/null/index.html')
-rw-r--r-- | files/ko/web/javascript/reference/global_objects/null/index.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/files/ko/web/javascript/reference/global_objects/null/index.html b/files/ko/web/javascript/reference/global_objects/null/index.html new file mode 100644 index 0000000000..e69295c9f6 --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/null/index.html @@ -0,0 +1,69 @@ +--- +title: 'null' +slug: Web/JavaScript/Reference/Global_Objects/null +tags: + - JavaScript + - Literal + - Primitive + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/null +--- +<div>{{jsSidebar("Objects")}}</div> + +<p><strong><code>null</code></strong>은 JavaScript의 {{Glossary("Primitive", "원시 값")}} 중 하나로, 어떤 값이 의도적으로 비어있음을 표현하며 불리언 연산에서는 {{glossary("falsy", "거짓")}}으로 취급합니다.</p> + +<div>{{EmbedInteractiveExample("pages/js/globalprops-null.html")}}</div> + + + +<h2 id="설명">설명</h2> + +<p><code>null</code>은 리터럴로서, <code>null</code>로 작성할 수 있습니다. <code>null</code>은 {{jsxref("undefined")}}와 같은 전역 객체의 식별자가 아닙니다. 대신 식별되지 않은 상태를 나타내며 해당 변수가 어떠한 객체도 가리키고 있지 않음을 표시합니다. API에서는 대개 객체를 기대했지만, 어떤 적합한 객체도 존재하지 않을 때 반환합니다.</p> + +<pre class="brush: js">// 정의되지 않고 초기화된 적도 없는 foo +foo; //ReferenceError: foo is not defined + +// 존재하지만 값이나 자료형이 존재하지 않는 foo +var foo = null; +foo; //null +</pre> + +<h3 id="null과_undefined의_차이"><code>null</code>과 <code>undefined</code>의 차이</h3> + +<p><code>null</code> 또는 <code>undefined</code>를 검사할 때, <a href="/ko/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">동등 연산자(==)와 일치 연산자(===)의 차이</a>를 주의하세요. 동등 연산자는 자료형 변환을 수행합니다.</p> + +<pre class="brush: js">typeof null // "object" (하위호환 유지를 위해 "null"이 아님) +typeof undefined // "undefined" +null === undefined // false +null == undefined // true +null === null // true +null == null // true +!null // true +isNaN(1 + null) // false +isNaN(1 + undefined) // true</pre> + +<h2 id="명세">명세</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">명세</th> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-null-value', 'null value')}}</td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + + + +<p>{{Compat("javascript.builtins.null")}}</p> + +<h2 id="같이_보기">같이 보기</h2> + +<ul> + <li>{{jsxref("undefined")}}</li> + <li>{{jsxref("NaN")}}</li> +</ul> |