Skip to content

Commit a41383a

Browse files
committed
[문서] C02 - 2.9 비교 연산자 충돌 해결 및 번역 진행
1 parent 9cd806b commit a41383a

2 files changed

Lines changed: 5 additions & 38 deletions

File tree

1-js/02-first-steps/09-comparison/1-comparison-questions/solution.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,10 @@ null === +"\n0\n" → false
1212

1313
해설:
1414

15-
<<<<<<< HEAD
1615
1. 명백히 true입니다.
1716
2. 문자열의 비교는 사전순서가 기준이므로 false입니다. `"a"``"p"`보다 작습니다.
18-
3. 두 피연산자는 문자열이므로, 사전순으로 비교가 이뤄집니다. 왼쪽 피연산자의 첫 번째 글자 `"2"`는 오른쪽 피연산자의 첫 번째 글자 `"1"`보다 큽니다.
17+
3. 두 피연산자는 문자열이므로, 사전 순으로 비교가 이뤄집니다. 왼쪽 피연산자의 첫 번째 글자 `"2"`는 오른쪽 피연산자의 첫 번째 글자 `"1"`보다 큽니다.
1918
4. `null``undefined`는 같습니다.
2019
5. 일치 연산자는 형도 체크합니다. 형이 다르면 false가 반환됩니다.
2120
6. (4)와 유사한 문제입니다. `null`은 오직 `undefined`와 같습니다.
2221
7. 형이 다르므로 false가 반환됩니다.
23-
=======
24-
1. Obviously, true.
25-
2. Dictionary comparison, hence false. `"a"` is smaller than `"p"`.
26-
3. Again, dictionary comparison, first char `"2"` is greater than the first char `"1"`.
27-
4. Values `null` and `undefined` equal each other only.
28-
5. Strict equality is strict. Different types from both sides lead to false.
29-
6. Similar to `(4)`, `null` only equals `undefined`.
30-
7. Strict equality of different types.
31-
>>>>>>> upstream/master

1-js/02-first-steps/09-comparison/article.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,14 @@
44

55
자바스크립트에서 기본 수학 연산은 아래와 같은 문법을 사용해 표현할 수 있습니다.
66

7-
<<<<<<< HEAD
87
- 보다 큼·작음: <code>a &gt; b</code>, <code>a &lt; b</code>
98
- 보다 크거나·작거나 같음: <code>a &gt;= b</code>, <code>a &lt;= b</code>
109
- 같음(동등): `a == b`. 등호 `=`가 두 개 연달아 오는 것에 유의하세요. `a ​​= b`와 같이 등호가 하나일 때는 할당을 의미합니다.
11-
- 같지 않음(부등): 같지 않음을 나타내는 수학 기호 <code>&ne;</code>는 자바스크립트에선 <code>a != b</code>로 나타냅니다. 할당연산자 `=` 앞에 느낌표 `!`를 붙여서 표시합니다.
10+
- 같지 않음(부등): 같지 않음을 나타내는 수학 기호 <code>&ne;</code>는 자바스크립트에선 <code>a != b</code>로 나타냅니다.
1211

1312
이번 글에선 비교 시 일어나는 기이한 현상을 포함하여 다양한 자료형을 대상으로 자바스크립트가 어떻게 비교를 하는지에 대해 다룰 예정입니다.
1413

1514
글 말미에는 자바스크립트에서만 일어나는 '기이한' 현상을 어떻게 예방할 수 있는지에 대해서 언급해두었습니다.
16-
=======
17-
- Greater/less than: <code>a &gt; b</code>, <code>a &lt; b</code>.
18-
- Greater/less than or equals: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
19-
- Equals: `a == b`, please note the double equality sign `==` means the equality test, while a single one `a = b` means an assignment.
20-
- Not equals: In maths the notation is <code>&ne;</code>, but in JavaScript it's written as <code>a != b</code>.
21-
22-
In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.
23-
24-
At the end you'll find a good recipe to avoid "JavaScript quirks"-related issues.
25-
>>>>>>> upstream/master
2615

2716
## 불린형 반환
2817

@@ -68,13 +57,9 @@ alert( 'Bee' > 'Be' ); // true
6857
4. 글자 간 비교가 끝날 때까지 이 과정을 반복합니다.
6958
5. 비교가 종료되었고 문자열의 길이도 같다면 두 문자열은 동일하다고 결론 냅니다. 비교가 종료되었지만 두 문자열의 길이가 다르면 길이가 긴 문자열이 더 크다고 결론 냅니다.
7059

71-
<<<<<<< HEAD
72-
예시의 `'Z' > 'A'`는 위 알고리즘의 첫 번째 단계에서 비교 결과가 도출됩니다. 반면, 문자열 `'Glow'``'Glee'`는 복수의 문자로 이루어진 문자열이기 때문에, 아래와 같은 순서로 문자열 비교가 이뤄집니다.
73-
=======
74-
In the first example above, the comparison `'Z' > 'A'` gets to a result at the first step.
60+
위 첫 번째 예시에서 `'Z' > 'A'` 비교는 첫 번째 단계에서 결과가 도출됩니다.
7561

76-
The second comparison `'Glow'` and `'Glee'` needs more steps as strings are compared character-by-character:
77-
>>>>>>> upstream/master
62+
두 번째 비교인 `'Glow'``'Glee'`는 문자열이 글자 단위로 비교되므로 더 많은 단계가 필요합니다.
7863

7964
1. `G``G`와 같습니다.
8065
2. `l``l`과 같습니다.
@@ -224,16 +209,8 @@ alert( undefined == 0 ); // false (3)
224209

225210
## 요약
226211

227-
<<<<<<< HEAD
228212
- 비교 연산자는 불린값을 반환합니다.
229213
- 문자열은 문자 단위로 비교되는데, 이때 비교 기준은 '사전' 순입니다.
230214
- 서로 다른 타입의 값을 비교할 땐 숫자형으로 형 변환이 이뤄지고 난 후 비교가 진행됩니다(일치 연산자는 제외).
231215
- `null``undefined`는 동등 비교(`==`) 시 서로 같지만 다른 값과는 같지 않습니다.
232-
- `null`이나 `undefined`가 될 확률이 있는 변수가 `>` 또는 `<`의 피연산자로 올 때는 주의를 기울이시기 바랍니다. `null`, `undefined` 여부를 확인하는 코드를 따로 추가하는 습관을 들이길 권유합니다.
233-
=======
234-
- Comparison operators return a boolean value.
235-
- Strings are compared letter-by-letter in the "dictionary" order.
236-
- When values of different types are compared, they get converted to numbers (with the exclusion of a strict equality check).
237-
- The values `null` and `undefined` are equal `==` to themselves and each other, but do not equal any other value.
238-
- Be careful when using comparisons like `>` or `<` with variables that can occasionally be `null/undefined`. Checking for `null/undefined` separately is a good idea.
239-
>>>>>>> upstream/master
216+
- `null`이나 `undefined`가 될 확률이 있는 변수가 `>` 또는 `<`의 피연산자로 올 때는 주의를 기울이시기 바랍니다. `null`, `undefined` 여부를 확인하는 코드를 따로 추가하는 습관을 들이길 권유합니다.

0 commit comments

Comments
 (0)