From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/glossary/falsy/index.html | 107 +++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 files/ko/glossary/falsy/index.html (limited to 'files/ko/glossary/falsy') diff --git a/files/ko/glossary/falsy/index.html b/files/ko/glossary/falsy/index.html new file mode 100644 index 0000000000..5b9f046a7a --- /dev/null +++ b/files/ko/glossary/falsy/index.html @@ -0,0 +1,107 @@ +--- +title: 거짓같은 값 +slug: Glossary/Falsy +tags: + - CodingScripting + - Glossary + - JavaScript + - 거짓 같은 값 +translation_of: Glossary/Falsy +--- +

거짓 같은 값(Falsy, falsey로 쓰이기도 함) 값은 {{Glossary("Boolean","불리언")}} 문맥에서 false로 평가되는 값입니다.

+ +

{{Glossary("JavaScript")}}는 {{Glossary("Conditional", "조건절")}}, {{Glossary("Loop", "반복문")}} 등 불리언 값이 필요한 곳에서 {{Glossary("Type_Conversion", "형 변환")}}을 이용해 특정 값을 불리언 값으로 변환합니다.

+ +

다음은 8가지 거짓 같은 값들입니다:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
false키워드 false
0숫자 zero
-0음수 zero
0nBigInt. 불리언으로 사용될 경우, 숫자와 같은 규칙을 따름. 0n은 거짓 같은 값.
"" +

string

+
{{Glossary("null")}}null - 아무런 값도 없음
{{Glossary("undefined")}}undefined - 원시값
{{Glossary("NaN")}}NaN - 숫자가 아님
+ +
+

오브젝트는  [[IsHTMLDDA]] internal slot 을 가지고 있어야 거짓같은 값이 됩니다. 이 슬롯은 document.all 에만 존재하며 자바스크립트로 설정될 수 없습니다.

+
+ +

예제

+ +

다음은 거짓 같은 값의 예시입니다. 거짓 같은 값은 불리언 문맥에서 false로 변환되므로, 아래의 모든 if 블록은 실행되지 않습니다.

+ +
if (false)
+if (null)
+if (undefined)
+if (0)
+if (-0)
+if (0n)
+if (NaN)
+if ("")
+
+ +

논리 AND 연산자, &&

+ +

첫 번째 객체가 거짓 같은 값이라면, 해당 객체를 반환합니다.

+ +
false && "dog"
+// ↪ false
+
+0 && "dog"
+// ↪ 0
+
+ +

Specifications

+ + + + + + + + + + + + +
Specification
{{SpecName("ESDraft", "#sec-toboolean", "ToBoolean abstract operation")}}
+ +

같이 보기

+ + + +

{{QuickLinksWithSubpages("/ko/docs/Glossary")}}

-- cgit v1.2.3-54-g00ecf