@@ -498,17 +498,17 @@ c["key"] === undefined
498
498
499
499
더보기: [ MDN Symbol] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol )
500
500
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 ` 와 같은 내장 객체를 서브클래스화 할 수 있다.
503
503
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
+ - 새 인스턴스에서 생성자를 실행해서 초기화한다.
507
507
508
- The known ` @@create ` symbol is available via ` Symbol.create ` . Built-ins now expose their ` @@create ` explicitly .
508
+ ` @@create ` 심볼은 ` Symbol.create ` 을 통해 사용할 수 있다. 이제 내장 객체는 ` @@create ` 를 명시적으로 노출하게 된다 .
509
509
510
510
``` JavaScript
511
- // Pseudo-code of Array
511
+ // Array 클래스의 슈도 코드
512
512
class Array {
513
513
constructor (... args ) { /* ... */ }
514
514
static [Symbol .create ]() {
@@ -517,14 +517,14 @@ class Array {
517
517
}
518
518
}
519
519
520
- // User code of Array subclass
520
+ // Array 서브클래스의 사용자 코드
521
521
class MyArray extends Array {
522
522
constructor (... args ) { super (... args); }
523
523
}
524
524
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) 새로운 인스턴스에서의 생성자 실행
528
528
var arr = new MyArray ();
529
529
arr[1 ] = 12 ;
530
530
arr .length == 2
0 commit comments