Skip to content

Commit 05723a9

Browse files
committed
빌트인 객체의 서브클래스화 번역 #6
1 parent 35b20b9 commit 05723a9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,17 @@ c["key"] === undefined
498498

499499
더보기: [MDN Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
500500

501-
### Subclassable Built-ins
502-
In ES6, built-ins like `Array`, `Date` and DOM `Element`s can be subclassed.
501+
### 내장 객체의 서브클래스화
502+
ES6에서는 `Array`, `Date`, 돔 `Element`와 같은 내장 객체를 서브클래스화 할 수 있다.
503503

504-
Object construction for a function named `Ctor` now uses two-phases (both virtually dispatched):
505-
- Call `Ctor[@@create]` to allocate the object, installing any special behavior
506-
- Invoke constructor on new instance to initialize
504+
`Ctor`라는 이름의 함수 객체 생성은 이제 2단계를 사용한다. (모두 가상으로 실행)
505+
- 객체 할당을 위해 `Ctor[@@create]`를 호출하고, 해당 객체에 특별 속성을 설치한다.
506+
- 새 인스턴스에서 생성자를 실행해서 초기화한다.
507507

508-
The known `@@create` symbol is available via `Symbol.create`. Built-ins now expose their `@@create` explicitly.
508+
`@@create` 심볼은 `Symbol.create`을 통해 사용할 수 있다. 이제 내장 객체는 `@@create`를 명시적으로 노출하게 된다.
509509

510510
```JavaScript
511-
// Pseudo-code of Array
511+
// Array 클래스의 슈도 코드
512512
class Array {
513513
constructor(...args) { /* ... */ }
514514
static [Symbol.create]() {
@@ -517,14 +517,14 @@ class Array {
517517
}
518518
}
519519

520-
// User code of Array subclass
520+
// Array 서브클래스의 사용자 코드
521521
class MyArray extends Array {
522522
constructor(...args) { super(...args); }
523523
}
524524

525-
// Two-phase 'new':
526-
// 1) Call @@create to allocate object
527-
// 2) Invoke constructor on new instance
525+
// 'new'의 2단계:
526+
// 1) 객체 할당을 위한 @@create 호출
527+
// 2) 새로운 인스턴스에서의 생성자 실행
528528
var arr = new MyArray();
529529
arr[1] = 12;
530530
arr.length == 2

0 commit comments

Comments
 (0)