Skip to content

Commit

Permalink
fix grammar err
Browse files Browse the repository at this point in the history
  • Loading branch information
hochan222 authored and pje1740 committed Aug 10, 2022
1 parent 2ed2730 commit bf9e7eb
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 30 deletions.
156 changes: 150 additions & 6 deletions files/ko/web/javascript/guide/index.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions files/ko/web/javascript/guide/indexed_collections/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ emp[1] = 'Phil Lesh';
emp[2] = 'August West';
```

<div class="note"><p><strong>참고: </strong>위의 코드 예제 처럼 배열 연산자에 양의 정수가 아닌 값을 줄 경우, 배열의 요소가 대신 배열로 대변되는 객체의 속성이 생성이 됩니다.</p></div>
> **Note:** 위의 코드 예제 처럼 배열 연산자에 양의 정수가 아닌 값을 줄 경우, 배열의 요소가 대신 배열로 대변되는 객체의 속성이 생성이 됩니다.
```js
var arr = [];
Expand All @@ -112,7 +112,7 @@ var myArray = ['Wind', 'Rain', 'Fire'];

배열의 첫번째 요소는 `myArray[0]로 참조할 수 있고 두번째 요소는 myArray[1]로 참조할 수 있습니다. 배열의 인덱스 값은 0부터 시작합니다.`

<div class="note"><p><strong>참고: </strong>배열 연산자(대괄호)는 배열의 속성에 접근하기 위해서도 사용될 수 있습니다.(배열 또한 객체이기 때문입니다.) 예를 들면 아래와 같습니다.</p></div>
> **Note:** 배열 연산자(대괄호)는 배열의 속성에 접근하기 위해서도 사용될 수 있습니다.(배열 또한 객체이기 때문입니다.) 예를 들면 아래와 같습니다.
```js
var arr = ['one', 'two', 'three'];
Expand Down
2 changes: 2 additions & 0 deletions files/ko/web/javascript/guide/introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Scratchpad를 열기 위해, Firefox의 메뉴 "Tools" 의 하위에 있는 "Web

JavaScript 작성을 시작하기 위해서, Scratchpad를 열고 첫 JavaScript 코드 "Hello World" 를 작성하세요.

```javascript
(function(){
"use strict";
/* Start of your code */
Expand All @@ -118,6 +119,7 @@ JavaScript 작성을 시작하기 위해서, Scratchpad를 열고 첫 JavaScript
greetMe('World');
/* End of your code */
})();
```

패드에서 코드를 선택하고 Ctrl + R 키를 눌러 브라우저에서 펼쳐지는 것을 지켜보십시오! 다음 페이지에서 이 가이드는 JavaScript 구문 및 언어 기능을 소개하므로보다 복잡한 응용 프로그램을 작성할 수 있습니다. 그러나 당분간은 `(function () { "use strict"`를 코드 앞에 추가하고`}}) ();`를 코드마지막에 추가하세요. 아직은 이코드가 뭔지 잘 모르겠지만 나중에 이 코드가 의미하는 것을 배울 것입니다, 지금은 간단히 다음과 같다고 생각하세요.

Expand Down
10 changes: 9 additions & 1 deletion files/ko/web/javascript/guide/iterators_and_generators/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators

여기에 실습할 수 있는 예제가 있습니다. `start`에서 `end`까지 `step` 수 만큼 띄어진 정수 시퀀스를 정의하는 간단한 범위 반복자를 만들 수 있습니다. 최종적으로 시퀀스의 크기가 반환됩니다.

```javascript
function makeRangeIterator(start = 0, end = Infinity, step = 1) {
var nextIndex = start;
var n = 0;
Expand All @@ -49,9 +50,11 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators
};
return rangeIterator;
}
```

위의 반복자를 사용하면 아래와 같습니다:

```javascript
var it = makeRangeIterator(1, 4);

var result = it.next();
Expand All @@ -61,8 +64,9 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators
}

console.log("Iterated over sequence of size: ", result.value);
```

<div class="note"><p>It is not possible to know reflectively whether a particular object is an iterator. If you need to do this, use <a href="https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/Iterators_and_Generators$edit#Iterables">Iterables</a>.</p></div>
It is not possible to know reflectively whether a particular object is an iterator. If you need to do this, use [Iterables](https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/Iterators_and_Generators$edit#Iterables).

## Generator functions

Expand All @@ -72,6 +76,7 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators

위의 예제 코드에 생성자를 적용한 것입니다. 두 코드의 행위는 동일하지만, 생성자를 사용한 쪽이 쓰거나 읽기가 훨씬 쉽습니다.

```javascript
function* makeRangeIterator(start = 0, end = Infinity, step = 1) {
let n = 0;
for (let i = start; i < end; i += step) {
Expand All @@ -80,6 +85,7 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators
}
return n;
}
```

## Iterables

Expand All @@ -93,6 +99,7 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators

이와 같이 자신의 반복가능 객체를 만들 수 있습니다:

```javascript
var myIterable = {
*[Symbol.iterator]() {
yield 1;
Expand All @@ -111,6 +118,7 @@ translation_of: Web/JavaScript/Guide/Iterators_and_Generators
or

[...myIterable]; // [1, 2, 3]
```

### 내장 iterable

Expand Down
10 changes: 10 additions & 0 deletions files/ko/web/javascript/guide/loops_and_iteration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ for (step = 0; step < 5; step++) {

for 반복문은 어떤 특정한 조건이 거짓으로 판별될 때까지 반복합니다. 자바스크립트의 반복문은 C의 반복문과 비슷합니다. for 반복문은 다음과 같습니다.

```
for ([초기문]; [조건문]; [증감문])
문장
```

for문이 실행될 때, 다음과 같이 실행됩니다.:

Expand Down Expand Up @@ -86,9 +88,11 @@ btn.addEventListener("click", function(){

do...while 문은 특정한 조건이 거짓으로 판별될 때까지 반복합니다. do...while 문은 다음과 같습니다.

```
do
문장
while (조건문);
```

`조건문을 확인하기 전에 문장은 한번 실행됩니다. 많은 문장을 실행하기 위해선 { }를 써서 문장들을 묶어줍니다. 만약 조건이 참이라면, 그 문장은 다시 실행됩니다. 매 실행 마지막마다 조건문이 확인됩니다. 만약 조건문이 거짓일 경우, 실행을 멈추고 do...while 문 바로 아래에 있는 문장으로 넘어가게 합니다.`

Expand All @@ -107,8 +111,10 @@ do {

while 문은 어떤 조건문이 참이기만 하면 문장을 계속해서 수행합니다. while 문은 다음과 같습니다.

```
while (조건문)
문장
```

만약 조건문이 거짓이 된다면, 그 반복문 안의 문장은 실행을 멈추고 반복문 바로 다음의 문장으로 넘어갑니다.

Expand Down Expand Up @@ -154,8 +160,10 @@ while (true) {

레이블 문의 구문은 다음과 같습니다:

```
label :
statement
```

레이블 값은 예약어가 아닌 임의의 JavaScript 식별자일 수 있습니다. 여러분이 레이블을 가지고 식별하는 문은 어떠한 문이 될 수 있습니다.

Expand Down Expand Up @@ -308,9 +316,11 @@ car.model = Mustang

[`for...of`](/en-US/docs/Web/JavaScript/Reference/Statements/for...of) 문은 각각의 고유한 특성의 값을 실행할 명령과 함께 사용자 지정 반복 후크를 호출하여, [반복 가능한 객체](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/iterable)({{jsxref("배열")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, [인수](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments) 객체 등을 포함)를 통해 반복하는 루프를 만듭니다.

```
for (variable of object) {
statement
}
```

다음 예는 for...of 루프와 [`for...in`](/en-US/docs/Web/JavaScript/Reference/Statements/for...in "en-US/docs/JavaScript/Reference/Statements/for...in") 루프의 차이를 보여줍니다. 속성 이름을 통해 for...in이 반복하는 동안, for...of은 속성 값을 통해 반복합니다:

Expand Down
8 changes: 8 additions & 0 deletions files/ko/web/javascript/guide/meta_programming/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,21 @@ typeof proxy; // "object", typeof doesn't trigger any trap

With {{jsxref("Reflect.has()")}} for example, you get the [`in` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in) as a function:

```js
Reflect.has(Object, 'assign'); // true
```

### A better `apply` function

In ES5, you typically use the {{jsxref("Function.prototype.apply()")}} method to call a function with a given `this` value and `arguments` provided as an array (or an [array-like object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections#Working_with_array-like_objects)).

```js
Function.prototype.apply.call(Math.floor, undefined, [1.75]);
```

With {{jsxref("Reflect.apply")}} this becomes less verbose and easier to understand:

```js
Reflect.apply(Math.floor, undefined, [1.75]);
// 1;

Expand All @@ -390,15 +395,18 @@ With {{jsxref("Reflect.apply")}} this becomes less verbose and easier to underst

Reflect.apply(''.charAt, 'ponies', [3]);
// "i"
```

### Checking if property definition has been successful

With {{jsxref("Object.defineProperty")}}, which returns an object if successful, or throws a {{jsxref("TypeError")}} otherwise, you would use a {{jsxref("Statements/try...catch","try...catch")}} block to catch any error that occurred while defining a property. Because {{jsxref("Reflect.defineProperty")}} returns a Boolean success status, you can just use an {{jsxref("Statements/if...else","if...else")}} block here:

```js
if (Reflect.defineProperty(target, property, attributes)) {
// success
} else {
// failure
}
```

{{Previous("Web/JavaScript/Guide/Iterators_and_Generators")}}
32 changes: 16 additions & 16 deletions files/ko/web/javascript/guide/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,31 @@ translation_of: Web/JavaScript/Guide/Modules

좋은 소식은 최신 브라우저가 기본적으로 모듈 기능을 지원하기 시작했으며, 이것이 이 기사의 전부입니다. 브라우저는 모듈의 로딩을 최적화 할 수 있기 때문에 라이브러리를 사용하는 것보다 더 효율적이며, 클라이언트 측에서의 추가 처리와 여분의 왕복을 모두 해야하는 것 보다 효율적입니다.

## Browser support
## 브라우저 호환성

네이티브 자바스크립트 모듈은 [`import`](/en-US/docs/Web/JavaScript/Reference/Statements/import)[`export`](/en-US/docs/Web/JavaScript/Reference/Statements/export) 문(statement)에 의존적이며, 호환성은 다음과 같습니다.

### import

{{Compat("javascript.statements.import")}}

### export

{{Compat("javascript.statements.export")}}
{{Compat}}

## Introducing an example

모듈 사용법을 설명하기 위해 Github에 [간단한 예제 모음](https://github.com/mdn/js-examples/tree/master/module-examples)을 만들었습니다. 이 예제들은 웹 페이지에 {{htmlelement("canvas")}} 요소(element)를 만들고, 캔버스에 다양한 도형을 그리고, 그린것에 대한 정보를 보고하는 간단한 모듈 집합입니다.

이것들은 매우 사소한 것이지만, 모듈을 명확하게 설명하기 의해 의도적으로 단순하게 유지중입니다.

<div class="blockIndicator note"><p><strong>주의</strong>: 예제를 다운로드하여 로컬에서 실행하려면, 로컬 웹 서버를 통해 예제를 실행해야 합니다.</p></div>
> **주의:** 예제를 다운로드하여 로컬에서 실행하려면, 로컬 웹 서버를 통해 예제를 실행해야 합니다.
## Basic example structure

첫 번째 예제([basic-modules](https://github.com/mdn/js-examples/tree/master/module-examples/basic-modules))를 보면 다음과 같은 파일 구조가 있습니다.

```
index.html
main.js
modules/
canvas.js
square.js
```

<div class="blockIndicator note"><p><strong>주의</strong>: 이 가이드의 모든 예제는 기본적으로 동일한 구조를 가집니다. 위의 내용에 익숙해지시는게 좋습니다.</p></div>
> **주의:** 이 가이드의 모든 예제는 기본적으로 동일한 구조를 가집니다. 위의 내용에 익숙해지시는게 좋습니다.
modules 디렉토리의 두 모듈은 다음과 같습니다.

Expand Down Expand Up @@ -105,15 +99,19 @@ import { name, draw, reportArea, reportPerimeter } from './modules/square.js';

예를들면,

```bash
/js-examples/modules/basic-modules/modules/square.js
```

이렇게 쓸 수 있습니다.

```bash
./modules/square.js
```

[`main.js`](https://github.com/mdn/js-examples/blob/master/module-examples/basic-modules/main.js)에서 이러한 코드를 볼 수 있습니다.

<div class="blockIndicator note"><p><strong>주의</strong>: 일부 모듈 시스템에서는 파일 확장명을 생략할 수 있습니다. (예: <code>'/modules/square'</code>). 이것은 네이티브 자바스크립트에서는 작동하지 않습니다. 또한 앞에 슬래시를 포함해야 합니다.</p></div>
> **주의:** 일부 모듈 시스템에서는 파일 확장명을 생략할 수 있습니다. (예: `'/modules/square'`). 이것은 네이티브 자바스크립트에서는 작동하지 않습니다. 또한 앞에 슬래시를 포함해야 합니다.
우리의 스크립트에 기능을 가져오면 동일한 파일 내에 정의한 것처럼 기능을 사용할 수 있습니다. 다음은 `main.js` 의 import 행 아래에 있습니다.

Expand All @@ -140,7 +138,7 @@ reportPerimeter(square1.length, reportList);

`import``export` 문(statement)은 모듈 내에서만 사용할 수 있습니다. 정규 스크립트가 아닙니다.

<div class="blockIndicator note"><p><strong>주의</strong>: <code>type="module"</code>을 포함하면 인터널 스크립트에서도 import 모듈을 사용할 수 있습니다. 예: <code>&#x3C;script type="module"> /* 여기에 코드를 작성하세요 */ &#x3C;/script></code>.</p></div>
> **주의:** `type="module"`을 포함하면 인터널 스크립트에서도 import 모듈을 사용할 수 있습니다. 예: `<script type="module"> /* 여기에 코드를 작성하세요 */ </script>`.
## Other differences between modules and standard scripts

Expand Down Expand Up @@ -183,7 +181,7 @@ import randomSquare from './modules/square.js';
import {default as randomSquare} from './modules/square.js';
```

<div class="blockIndicator note"><p><strong>주의</strong>: export한 항목의 이름을 바꾸는 구문은 <a href="#renaming_imports_and_exports">Renaming imports and exports</a> 섹션에서 설명합니다.</p></div>
> **주의:** export한 항목의 이름을 바꾸는 구문은 [Renaming imports and exports](#renaming_imports_and_exports) 섹션에서 설명합니다.
## Avoiding naming conflicts

Expand Down Expand Up @@ -367,13 +365,15 @@ export { name } from 'x.js'

예를들어 [module-aggregation](https://github.com/mdn/js-examples/tree/master/module-examples/module-aggregation) 디렉토리를 참조하겠습니다. 이 예제에서는 이전 클래스 예제를 기반으로 `circle.js`, `square.js`, `triangle.js` 의 모든 기능을 함께 모으는 `shapes.js`라는 추가 모듈이 있습니다. 또한 우리는 `shapes` 모듈 디렉토리 안에 있는 서브 디렉토리 내에서 서브 모듈을 이동 시켰습니다. 이제 모듈 구조는 다음과 같습니다.

```
modules/
canvas.js
shapes.js
shapes/
circle.js
square.js
triangle.js
```

각 하위 모듈에서 export 형태는 같습니다. 예)

Expand All @@ -391,7 +391,7 @@ export { Circle } from './shapes/circle.js';

이 모듈은 각각의 서브 모듈의 export를 가져와서 `shapes.js` 모듈에서 효과적으로 사용할 수 있도록 합니다.

<div class="blockIndicator note"><p><strong>주의</strong>: <code>shapes.js</code> 에서 참조되는 export는 기본적으로 파일을 통해 리다이렉트 되고 실제로는 존재하지 않으므로, 같은 파일 내에 유용한 코드를 쓸 수 없습니다.</p></div>
> **주의:** `shapes.js` 에서 참조되는 export는 기본적으로 파일을 통해 리다이렉트 되고 실제로는 존재하지 않으므로, 같은 파일 내에 유용한 코드를 쓸 수 없습니다.
이제 `main.js` 파일에서 우리는 세 개의 모듈 클래스를 모두 대체할 수 있습니다.

Expand Down
2 changes: 2 additions & 0 deletions files/ko/web/javascript/guide/numbers_and_dates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ var m = 0644; // 420

ECMAScript 5의 Strict 모드는 8 진수 구문을 금지합니다. 8 진수 구문은 ECMAScript 5의 일부가 아니지만, `0644 === 420``"\ 045"=== "%"`의 8 진수에 접두사를 붙이면 모든 브라우저에서 지원됩니다. ECMAScript 2015에서는 접두어가 `0o`인 경우 8 진수가 지원됩니다 (예 :

```javascript
var a = 0o10; // ES2015: 8
```

### 16진수

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ original_slug: Web/JavaScript/Guide/Regular_Expressions/Groups_and_Ranges
</tbody>
</table>

## Examples
## See also

## Browser support
- A polyfill of [`RegExp` named capture groups](https://github.com/zloirock/core-js#ecmascript-string-and-regexp) is available in [`core-js`](https://github.com/zloirock/core-js)
- [Regular expressions guide](/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)

Firefox currently doesn't support named groups. See [corresponding issue](https://bugzilla.mozilla.org/show_bug.cgi?id=1362154).
- [Character classes](/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes)
- [Assertions](/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Assertions)
- [Quantifiers](/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Quantifiers)
- [Unicode property escapes](/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes)

## See also
- [The `RegExp()` constructor](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)
- [ClassRanges in the ECMAScript specification](https://tc39.es/ecma262/multipage/text-processing.html#sec-classranges)
4 changes: 3 additions & 1 deletion files/ko/web/javascript/guide/using_promises/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,13 @@ new Promise((resolve, reject) => {

그러면 다음 텍스트가 출력됩니다.

```
Initial
Do that
Do this, whatever happened before
```

**참고:** "Do this" 텍스트가 출력되지 않은 것을 주의깊게 보십시오. "Something failed" 에러가 rejection을 발생시켰기 때문입니다.
> **참고:** "Do this" 텍스트가 출력되지 않은 것을 주의깊게 보십시오. "Something failed" 에러가 rejection을 발생시켰기 때문입니다.
## Error propagation

Expand Down

0 comments on commit bf9e7eb

Please sign in to comment.