19 전역 객체(The Global Object)

전역 객체:

19.1 전역 객체의 값(Value) 프로퍼티

19.1.1 globalThis

Realm Record realm 에서 전역 객체"globalThis" 프로퍼티 초기 값은 realm.[[GlobalEnv]].[[GlobalThisValue]] 이다.

이 프로퍼티는 { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } 특성을 갖는다.

19.1.2 Infinity

Infinity 의 값은 +∞𝔽 이다(6.1.6.1 참조). 이 프로퍼티는 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 특성을 갖는다.

19.1.3 NaN

NaN 의 값은 NaN 이다(6.1.6.1 참조). 이 프로퍼티는 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 특성을 갖는다.

19.1.4 undefined

undefined 의 값은 undefined 이다(6.1.1 참조). 이 프로퍼티는 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 특성을 갖는다.

19.2 전역 객체의 함수(Function) 프로퍼티

19.2.1 eval ( x )

이 함수는 %eval% 고유(intrinsic) 객체이다.

호출 시 다음 단계를 수행한다:

  1. Return ? PerformEval(x, false, false).

19.2.1.1 PerformEval ( x, strictCaller, direct )

The abstract operation PerformEval takes arguments x (ECMAScript 언어 값), strictCaller (Boolean), and direct (Boolean) and returns ECMAScript 언어 값을 담은 정상 completion 또는 throw completion. It performs the following steps when called:

  1. 단언: directfalse 이면 strictCallerfalse.
  2. x 가 String 이 아니면 x 를 반환.
  3. evalRealm 을 현재 Realm Record 로 둔다.
  4. 참고: direct eval 의 경우 evalRealmeval 호출자와 eval 함수 자체의 realm 이다.
  5. HostEnsureCanCompileStrings(evalRealm, « », x, direct) 수행.
  6. inFunction = false.
  7. inMethod = false.
  8. inDerivedConstructor = false.
  9. inClassFieldInitializer = false.
  10. directtrue 이면
    1. thisEnvRec = GetThisEnvironment().
    2. thisEnvRecFunction Environment Record 이면
      1. F = thisEnvRec.[[FunctionObject]].
      2. inFunction = true 로.
      3. inMethod = thisEnvRec.HasSuperBinding().
      4. F.[[ConstructorKind]]derived 이면 inDerivedConstructor = true.
      5. classFieldInitializerName = F.[[ClassFieldInitializerName]].
      6. classFieldInitializerNameempty 가 아니면 inClassFieldInitializer = true.
  11. 구현 정의 순서(파싱과 오류 검출을 교차 실행 가능)로 다음 하위 단계 수행:
    1. script = ParseText(x, Script).
    2. script 가 오류 리스트면 SyntaxError 예외 throw.
    3. script Contains ScriptBodyfalse 이면 undefined 반환.
    4. body = scriptScriptBody.
    5. inFunctionfalse 이고 body Contains NewTarget 이면 SyntaxError throw.
    6. inMethodfalse 이고 body Contains SuperProperty 이면 SyntaxError throw.
    7. inDerivedConstructorfalse 이고 body Contains SuperCall 이면 SyntaxError throw.
    8. inClassFieldInitializertrue 이고 ContainsArguments(body) 가 true 이면 SyntaxError throw.
  12. strictCallertrue 이면 strictEval = true.
  13. Else strictEval = ScriptIsStrict(script).
  14. runningContext = 실행 중 실행 컨텍스트.
  15. 참고: direct true 이면 호출한 컨텍스트; false 이면 eval 호출 실행 컨텍스트.
  16. directtrue 이면
    1. lexEnv = NewDeclarativeEnvironment(runningContext.LexicalEnvironment).
    2. varEnv = runningContext.VariableEnvironment.
    3. privateEnv = runningContext.PrivateEnvironment.
  17. Else
    1. lexEnv = NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]).
    2. varEnv = evalRealm.[[GlobalEnv]].
    3. privateEnv = null.
  18. strictEvaltrue 이면 varEnv = lexEnv.
  19. runningContext 가 아직 suspend 상태가 아니면 suspend.
  20. evalContext = 새 ECMAScript 코드 실행 컨텍스트.
  21. evalContext.Function = null.
  22. evalContext.Realm = evalRealm.
  23. evalContext.ScriptOrModule = runningContext.ScriptOrModule.
  24. evalContext.VariableEnvironment = varEnv.
  25. evalContext.LexicalEnvironment = lexEnv.
  26. evalContext.PrivateEnvironment = privateEnv.
  27. evalContext 를 실행 컨텍스트 스택에 push; 현재 실행 컨텍스트.
  28. result = Completion(EvalDeclarationInstantiation(body, varEnv, lexEnv, privateEnv, strictEval)).
  29. result 가 normal 이면
    1. result = Completion(Evaluation(body)).
  30. result 가 normal 이고 result.[[Value]]empty 이면
    1. result = NormalCompletion(undefined).
  31. evalContext suspend 후 스택에서 제거.
  32. 스택 맨 위 컨텍스트 resume.
  33. Return ? result.
Note

eval 코드는 호출 컨텍스트나 eval 코드 둘 중 하나라도 strict 모드이면 호출자 변수 환경에 var/function 바인딩을 인스턴스화할 수 없다. 대신 새 VariableEnvironment 에 인스턴스화된다. let, const, class 선언이 도입하는 바인딩은 항상 새 LexicalEnvironment 에 인스턴스화된다.

19.2.1.2 HostEnsureCanCompileStrings ( calleeRealm, parameterStrings, bodyString, direct )

The host-defined abstract operation HostEnsureCanCompileStrings takes arguments calleeRealm (Realm Record), parameterStrings (문자열 리스트), bodyString (String), and direct (Boolean) and returns unused 를 담은 정상 completion 또는 throw completion. 문자열을 ECMAScript 코드로 해석·평가할 수 있게 하는 특정 ECMAScript 함수를 호스트 환경이 차단할 수 있도록 한다.

parameterStrings 는 함수 생성자 중 하나를 사용할 때 파라미터 목록을 구성하기 위해 연결될 문자열들을 나타낸다. bodyString 은 함수 본문 또는 eval 에 전달된 문자열을 나타낸다. direct 는 평가가 direct eval 인지 여부를 나타낸다.

기본 구현은 NormalCompletion(unused) 을 반환한다.

19.2.1.3 EvalDeclarationInstantiation ( body, varEnv, lexEnv, privateEnv, strict )

The abstract operation EvalDeclarationInstantiation takes arguments body (ScriptBody Parse Node), varEnv (Environment Record), lexEnv (Declarative Environment Record), privateEnv (PrivateEnvironment Record 또는 null), and strict (Boolean) and returns unused 를 담은 정상 completion 또는 throw completion. It performs the following steps when called:

  1. varNames = VarDeclaredNames(body).
  2. varDeclarations = VarScopedDeclarations(body).
  3. strictfalse 이면
    1. varEnvGlobal Environment Record 이면
      1. namevarNames 에 대해
        1. HasLexicalDeclaration(varEnv, name) 가 true 이면 SyntaxError throw.
        2. 참고: eval 은 전역 lexical 선언에 의해 shadow 되는 전역 var 선언을 만들지 않는다.
    2. thisEnv = lexEnv.
    3. 단언: 다음 루프는 종료한다.
    4. 반복 (thisEnvvarEnv 가 동일 Environment Record 가 아닐 동안)
      1. thisEnvObject Environment Record 가 아니면
        1. 참고: with 문의 환경은 lexical 선언을 포함할 수 없으므로 var/let hoisting 충돌 점검 불필요.
        2. namevarNames 에 대해
          1. thisEnv.HasBinding(name) 가 true 이면
            1. Normative Optional
              호스트가 웹 브라우저이거나 Catch 블록 내 VariableStatement 를 지원하면
              1. thisEnvCatch 절의 Environment Record 가 아니면 SyntaxError throw.
            2. Else
              1. SyntaxError throw.
          2. 참고: direct eval 은 같은 이름의 lexical 선언 위로 var 를 hoist 하지 않는다.
      2. thisEnv = thisEnv.[[OuterEnv]].
  4. privateIdentifiers = 새 빈 리스트.
  5. pointer = privateEnv.
  6. 반복 (pointernull)
    1. pointer.[[Names]] 의 각 Private Name binding 에 대해
      1. privateIdentifiersbinding.[[Description]] 포함하지 않으면 append.
    2. pointer = pointer.[[OuterPrivateEnvironment]].
  7. AllPrivateIdentifiersValid(body, privateIdentifiers) 가 false 이면 SyntaxError throw.
  8. functionsToInitialize = 새 빈 리스트.
  9. declaredFunctionNames = 새 빈 리스트.
  10. varDeclarations 을 역순으로 순회하며 각 d 에 대해
    1. dVariableDeclaration, ForBinding, BindingIdentifier 가 아니면
      1. 단언: dFunctionDeclaration, GeneratorDeclaration, AsyncFunctionDeclaration, AsyncGeneratorDeclaration.
      2. 참고: 같은 이름의 다수 함수 선언이 있으면 마지막 것이 사용됨.
      3. fn = BoundNames(d) 의 유일한 요소.
      4. declaredFunctionNamesfn 포함하지 않으면
        1. varEnvGlobal Environment Record 이면
          1. fnDefinable = ? CanDeclareGlobalFunction(varEnv, fn).
          2. fnDefinablefalse 이면 TypeError throw.
        2. fndeclaredFunctionNames 에 추가.
        3. dfunctionsToInitialize 의 첫 요소로 삽입.
  11. declaredVarNames = 새 빈 리스트.
  12. varDeclarations 의 각 d 에 대해
    1. dVariableDeclaration, ForBinding, BindingIdentifier 이면
      1. BoundNames(d) 의 각 String vn 에 대해
        1. declaredFunctionNamesvn 포함하지 않으면
          1. varEnvGlobal Environment Record 이면
            1. vnDefinable = ? CanDeclareGlobalVar(varEnv, vn).
            2. vnDefinable false 이면 TypeError throw.
          2. declaredVarNamesvn 포함하지 않으면 append.
  13. Normative Optional
    strictfalse 이고 호스트가 웹 브라우저이거나 블록 수준 함수 선언 웹 레거시 호환 의미 를 지원하면
    1. declaredFunctionOrVarNames = declaredFunctionNamesdeclaredVarNames (리스트 연결).
    2. body Contains xtrue 인 모든 Block, CaseClause, DefaultClause xStatementList 에 직접 포함된 각 FunctionDeclaration f 에 대해
      1. F = fBindingIdentifier StringValue.
      2. fFBindingIdentifier 로 하는 VariableStatement 로 치환해도 body 에 Early Error 가 발생하지 않으면
        1. bindingExists = false.
        2. thisEnv = lexEnv.
        3. 단언: 루프 종료 보장.
        4. 반복 (thisEnvvarEnv)
          1. thisEnvObject Environment Record 가 아니면
            1. thisEnv.HasBinding(F) 가 true 이면
              1. Normative Optional
                호스트가 웹 브라우저이거나 Catch 블록 내 VariableStatement 를 지원하면
                1. thisEnvCatchEnvironment Record 가 아니면 bindingExists = true.
              2. Else
                1. bindingExists = true.
          2. thisEnv = thisEnv.[[OuterEnv]].
        5. bindingExistsfalse 이고 varEnvGlobal Environment Record 이면
          1. HasLexicalDeclaration(varEnv, F) 가 false 이면
            1. fnDefinable = ? CanDeclareGlobalVar(varEnv, F).
          2. Else
            1. fnDefinable = false.
        6. Else
          1. fnDefinable = true.
        7. bindingExists false 이고 fnDefinable true 이면
          1. declaredFunctionOrVarNamesF 포함하지 않으면
            1. varEnvGlobal Environment Record 이면
              1. CreateGlobalVarBinding(varEnv, F, true).
            2. Else
              1. bindingExists = ! varEnv.HasBinding(F).
              2. bindingExists false 이면
                1. varEnv.CreateMutableBinding(F, true).
                2. varEnv.InitializeBinding(F, undefined).
            3. FdeclaredFunctionOrVarNames 에 추가.
          2. FunctionDeclaration f 평가 시 15.2.6 의 기본 알고리즘 대신:
            1. gEnv = 실행 중 컨텍스트 VariableEnvironment.
            2. bEnv = 실행 중 컨텍스트 LexicalEnvironment.
            3. fObj = ! bEnv.GetBindingValue(F, false).
            4. gEnv.SetMutableBinding(F, fObj, false).
            5. unused 반환.
  14. 참고: varEnvGlobal Environment Record 이고 전역 객체가 Proxy exotic object 인 경우가 아니면 이 단계 이후 비정상 종료 없음.
  15. lexDeclarations = LexicallyScopedDeclarations(body).
  16. dlexDeclarations 에 대해
    1. 참고: 어휘 선언된 이름은 여기서 인스턴스화만 하고 초기화하지 않음.
    2. BoundNames(d) 의 각 dn 에 대해
      1. IsConstantDeclaration(d) true 이면
        1. lexEnv.CreateImmutableBinding(dn, true).
      2. Else
        1. lexEnv.CreateMutableBinding(dn, false).
  17. functionsToInitialize 의 각 Parse Node f 에 대해
    1. fn = BoundNames(f) 의 유일한 요소.
    2. fo = InstantiateFunctionObject(f, lexEnv, privateEnv).
    3. varEnvGlobal Environment Record 이면
      1. CreateGlobalFunctionBinding(varEnv, fn, fo, true).
    4. Else
      1. bindingExists = ! varEnv.HasBinding(fn).
      2. bindingExists false 이면
        1. 참고: 앞선 검증 때문에 abrupt 발생 불가.
        2. varEnv.CreateMutableBinding(fn, true).
        3. varEnv.InitializeBinding(fn, fo).
      3. Else
        1. varEnv.SetMutableBinding(fn, fo, false).
  18. 각 String vndeclaredVarNames 에 대해
    1. varEnvGlobal Environment Record 이면
      1. CreateGlobalVarBinding(varEnv, vn, true).
    2. Else
      1. bindingExists = ! varEnv.HasBinding(vn).
      2. bindingExists false 이면
        1. 참고: 앞선 검증으로 abrupt 불가.
        2. varEnv.CreateMutableBinding(vn, true).
        3. varEnv.InitializeBinding(vn, undefined).
  19. unused 반환.

19.2.2 isFinite ( number )

이 함수는 %isFinite% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. num = ? ToNumber(number).
  2. num 이 finite 가 아니면 false 반환.
  3. 그렇지 않으면 true 반환.

19.2.3 isNaN ( number )

이 함수는 %isNaN% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. num = ? ToNumber(number).
  2. numNaN 이면 true 반환.
  3. 그렇지 않으면 false 반환.
Note

XNaN 인지 신뢰성 있게 시험하는 ECMAScript 표현은 X !== X 형태이다. 결과가 true 이면 그리고 오직 그때만 XNaN 이다.

19.2.4 parseFloat ( string )

이 함수는 string 인수를 10진 리터럴로 해석한 결과에 따라 Number 값을 생성한다.

%parseFloat% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. inputString = ? ToString(string).
  2. trimmedString = ! TrimString(inputString, start).
  3. trimmed = StringToCodePoints(trimmedString).
  4. trimmedPrefix = StrDecimalLiteral 문법을 만족하는(없으면 없음) 가장 긴 접두사. 없다면 NaN 반환.
  5. parsedNumber = ParseText(trimmedPrefix, StrDecimalLiteral).
  6. 단언: parsedNumber 는 Parse Node.
  7. parsedNumber 의 StringNumericValue 반환.
Note

이 함수는 string 의 선두 일부만 Number 로 해석할 수 있고, 10진 표기 일부가 될 수 없는 코드 유닛은 무시하며 무시되었다는 표시를 제공하지 않는다.

19.2.5 parseInt ( string, radix )

이 함수는 radix 에 따라 string 내용을 해석하여 정수 Number 값을 생성한다. string 의 선행 공백은 무시된다. radix 가 0 으로 강제될 경우(예: undefined) 표현이 "0x" 또는 "0X" 로 시작하지 않으면 10, 그렇다면 16 으로 간주한다. radix 가 16 이면 표현은 "0x" / "0X" 로 시작할 수도 있다.

%parseInt% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. inputString = ? ToString(string).
  2. S = ! TrimString(inputString, start).
  3. sign = 1.
  4. S 가 비어 있지 않고 첫 코드 유닛이 0x002D 이면 sign = -1.
  5. S 가 비어 있지 않고 첫 코드 유닛이 0x002B 또는 0x002D 이면 S = 인덱스 1 부터.
  6. R = (? ToInt32(radix)).
  7. stripPrefix = true.
  8. R ≠ 0 이면
    1. R < 2 또는 R > 36 이면 NaN 반환.
    2. R ≠ 16 이면 stripPrefix = false.
  9. Else
    1. R = 10.
  10. stripPrefix true 이면
    1. S 길이 ≥ 2 이고 첫 두 코드 유닛이 "0x" 또는 "0X" 이면
      1. S = 인덱스 2 부터.
      2. R = 16.
  11. S 가 radix-R 숫자가 아닌 코드 유닛을 포함하면 end = 그 첫 위치, 아니면 길이.
  12. Z = S[0..end).
  13. Z 가 비어 있으면 NaN 반환.
  14. mathInt = Z 가 radix-R 표기에서 나타내는 정수 (규정된 근사 허용).
  15. mathInt = 0 이면
    1. sign = -1 이면 -0𝔽 반환.
    2. +0𝔽 반환.
  16. 𝔽(sign × mathInt) 반환.
Note

이 함수는 string 의 선두 일부만 정수로 해석할 수 있으며 나머지는 무시되고 무시 사실은 표시되지 않는다.

19.2.6 URI 처리 함수

Uniform Resource Identifier(URI)는 자원(웹 페이지, 파일 등)과 Internet 상에서 그것에 접근할 전송 프로토콜(HTTP, FTP 등)을 식별하는 String 이다. ECMAScript 자체는 이 절에 기술된 URI 인코딩·디코딩 함수 외에는 URI 사용 지원을 제공하지 않는다. encodeURI, decodeURI 는 전체 URI 에 사용하도록 의도되며 예약 문자는 특별한 의미(구분자 등)를 가정하므로 인코딩하지 않는다. encodeURIComponent, decodeURIComponent 는 URI 개별 구성 요소에 사용하도록 의도되며, 예약 문자가 텍스트를 나타낸다고 가정하고 전체 URI 의 일부가 될 때 특별한 의미를 피하기 위해 인코딩해야 한다.

Note 1

예약 문자 집합은 RFC 2396 에 기반하며 최신 RFC 3986 의 변경을 반영하지 않는다.

Note 2

많은 ECMAScript 구현은 웹 페이지를 조작하는 추가 함수·메서드를 제공하는데, 이는 표준 범위를 벗어난다.

19.2.6.1 decodeURI ( encodedURI )

이 함수는 encodeURI 가 도입할 수 있는 종류의 각 escape 시퀀스 및 UTF-8 인코딩을 해당 코드 포인트의 UTF-16 인코딩으로 치환한 URI 새 버전을 계산한다. encodeURI 가 도입할 수 없었던 escape 시퀀스는 치환하지 않는다.

%decodeURI% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. uriString = ? ToString(encodedURI).
  2. preserveEscapeSet = ";/?:@&=+$,#".
  3. Return ? Decode(uriString, preserveEscapeSet).

19.2.6.2 decodeURIComponent ( encodedURIComponent )

이 함수는 encodeURIComponent 가 도입할 수 있는 종류의 각 escape 시퀀스 및 UTF-8 인코딩을 해당 코드 포인트의 UTF-16 인코딩으로 치환한 새 버전을 계산한다.

%decodeURIComponent% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. componentString = ? ToString(encodedURIComponent).
  2. preserveEscapeSet = 빈 문자열.
  3. Return ? Decode(componentString, preserveEscapeSet).

19.2.6.3 encodeURI ( uri )

이 함수는 UTF-16 인코딩(6.1.4) 된 URI 에서 특정 코드 포인트의 각 출현을 그 코드 포인트의 UTF-8 인코딩을 나타내는 1~4개의 escape 시퀀스로 대체한 새 버전을 계산한다.

%encodeURI% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. uriString = ? ToString(uri).
  2. extraUnescaped = ";/?:@&=+$,#".
  3. Return ? Encode(uriString, extraUnescaped).

19.2.6.4 encodeURIComponent ( uriComponent )

이 함수는 UTF-16 인코딩된 URI 구성 요소에서 특정 코드 포인트의 각 출현을 그 코드 포인트의 UTF-8 인코딩을 나타내는 1~4개의 escape 시퀀스로 대체한 새 버전을 계산한다.

%encodeURIComponent% 고유 객체이다.

호출 시 다음 단계를 수행한다:

  1. componentString = ? ToString(uriComponent).
  2. extraUnescaped = 빈 문자열.
  3. Return ? Encode(componentString, extraUnescaped).

19.2.6.5 Encode ( string, extraUnescaped )

The abstract operation Encode takes arguments string (String) and extraUnescaped (String) and returns String 을 담은 정상 completion 또는 throw completion. string6.1.4 에 기술된 대로 UTF-16 인코딩된 코드 포인트 시퀀스로 해석하여 URI 인코딩·escape 를 수행한다. RFC 2396 에서 unreserved 로 식별되었거나 extraUnescaped 에 등장하는 문자는 escape 하지 않는다. It performs the following steps when called:

  1. len = string 길이.
  2. R = 빈 문자열.
  3. alwaysUnescaped = ASCII 단어 문자들과 "-.!~*'()" 의 문자열 연결.
  4. unescapedSet = alwaysUnescaped + extraUnescaped.
  5. k = 0.
  6. 반복 (k < len)
    1. C = string[k] 코드 유닛.
    2. unescapedSetC 포함하면
      1. k = k + 1.
      2. R = R + C.
    3. Else
      1. cp = CodePointAt(string, k).
      2. cp.[[IsUnpairedSurrogate]] true 이면 URIError throw.
      3. k = k + cp.[[CodeUnitCount]].
      4. Octets = cp.[[CodePoint]] 에 UTF-8 변환 적용한 octet 리스트.
      5. octetOctets 에 대해
        1. hex = octet 의 대문자 16진 문자열.
        2. R = R + "%" + StringPad(hex, 2, "0", start).
  7. R 반환.
Note

퍼센트 인코딩은 개별 octet 을 표현하므로 하나의 코드 포인트가 여러 연속 escape 시퀀스(각각 하나의 8비트 UTF-8 코드 유닛)에 의해 표현될 수 있다.

19.2.6.6 Decode ( string, preserveEscapeSet )

The abstract operation Decode takes arguments string (String) and preserveEscapeSet (String) and returns String 을 담은 정상 completion 또는 throw completion. preserveEscapeSet 에 포함된 Basic Latin 문자에 대응하는 escape 시퀀스를 보존하면서 URI unescape 및 디코딩을 수행한다. It performs the following steps when called:

  1. len = string 길이.
  2. R = 빈 문자열.
  3. k = 0.
  4. 반복 (k < len)
    1. C = string[k] 코드 유닛.
    2. S = C.
    3. C = 0x0025 ( %) 이면
      1. k + 3 > len 이면 URIError throw.
      2. escape = string[k .. k+3).
      3. B = ParseHexOctet(string, k + 1).
      4. B 가 정수가 아니면 URIError throw.
      5. k = k + 2.
      6. n = B 의 선행 1 비트 개수.
      7. n = 0 이면
        1. asciiChar = 값이 B 인 코드 유닛.
        2. preserveEscapeSetasciiChar 포함하면 S = escape, 아니면 S = asciiChar.
      8. Else
        1. n = 1 또는 n > 4 이면 URIError throw.
        2. Octets = « B ».
        3. j = 1.
        4. 반복 (j < n)
          1. k = k + 1.
          2. k + 3 > len 이면 URIError throw.
          3. string[k] ≠ 0x0025 이면 URIError throw.
          4. continuationByte = ParseHexOctet(string, k + 1).
          5. continuationByte 가 정수가 아니면 URIError throw.
          6. Octets 에 append(continuationByte).
          7. k = k + 2.
          8. j = j + 1.
        5. 단언: Octets 길이 = n.
        6. Octets 가 유효한 UTF-8 코드 포인트 인코딩이 아니면 URIError throw.
        7. V = UTF-8 변환을 적용해 얻은 코드 포인트.
        8. S = UTF16EncodeCodePoint(V).
    4. R = R + S.
    5. k = k + 1.
  5. R 반환.
Note

RFC 3629 는 잘못된 UTF-8 옥텟 시퀀스 디코딩을 금지한다. 예: 잘못된 시퀀스 0xC0 0x80 은 0x0000 으로 디코딩되어서는 안 된다. 구현은 그러한 시퀀스를 만나면 URIError 를 던져야 한다.

19.2.6.7 ParseHexOctet ( string, position )

The abstract operation ParseHexOctet takes arguments string (String) and position (음이 아닌 정수) and returns 음이 아닌 정수 또는 비어있지 않은 SyntaxError 객체 리스트. stringposition 위치에 있는 두 개 16진 문자를 부호 없는 8비트 정수로 파싱한다. It performs the following steps when called:

  1. len = string 길이.
  2. 단언: position + 2 ≤ len.
  3. hexDigits = string[position .. position+2).
  4. parseResult = ParseText(hexDigits, HexDigits[~Sep]).
  5. parseResult 가 Parse Node 가 아니면 parseResult 반환.
  6. n = parseResult 의 MV.
  7. 단언: 0 ≤ n ≤ 255.
  8. n 반환.

19.3 전역 객체의 생성자(Constructor) 프로퍼티

19.3.1 AggregateError ( . . . )

20.5.7.1 참조.

19.3.2 Array ( . . . )

23.1.1 참조.

19.3.3 ArrayBuffer ( . . . )

25.1.4 참조.

19.3.4 BigInt ( . . . )

21.2.1 참조.

19.3.5 BigInt64Array ( . . . )

23.2.5 참조.

19.3.6 BigUint64Array ( . . . )

23.2.5 참조.

19.3.7 Boolean ( . . . )

20.3.1 참조.

19.3.8 DataView ( . . . )

25.3.2 참조.

19.3.9 Date ( . . . )

21.4.2 참조.

19.3.10 Error ( . . . )

20.5.1 참조.

19.3.11 EvalError ( . . . )

20.5.5.1 참조.

19.3.12 FinalizationRegistry ( . . . )

26.2.1 참조.

19.3.13 Float16Array ( . . . )

23.2.5 참조.

19.3.14 Float32Array ( . . . )

23.2.5 참조.

19.3.15 Float64Array ( . . . )

23.2.5 참조.

19.3.16 Function ( . . . )

20.2.1 참조.

19.3.17 Int8Array ( . . . )

23.2.5 참조.

19.3.18 Int16Array ( . . . )

23.2.5 참조.

19.3.19 Int32Array ( . . . )

23.2.5 참조.

19.3.20 Iterator ( . . . )

27.1.3.1 참조.

19.3.21 Map ( . . . )

24.1.1 참조.

19.3.22 Number ( . . . )

21.1.1 참조.

19.3.23 Object ( . . . )

20.1.1 참조.

19.3.24 Promise ( . . . )

27.2.3 참조.

19.3.25 Proxy ( . . . )

28.2.1 참조.

19.3.26 RangeError ( . . . )

20.5.5.2 참조.

19.3.27 ReferenceError ( . . . )

20.5.5.3 참조.

19.3.28 RegExp ( . . . )

22.2.4 참조.

19.3.29 Set ( . . . )

24.2.2 참조.

19.3.30 SharedArrayBuffer ( . . . )

25.2.3 참조.

19.3.31 String ( . . . )

22.1.1 참조.

19.3.32 Symbol ( . . . )

20.4.1 참조.

19.3.33 SyntaxError ( . . . )

20.5.5.4 참조.

19.3.34 TypeError ( . . . )

20.5.5.5 참조.

19.3.35 Uint8Array ( . . . )

23.2.5 참조.

19.3.36 Uint8ClampedArray ( . . . )

23.2.5 참조.

19.3.37 Uint16Array ( . . . )

23.2.5 참조.

19.3.38 Uint32Array ( . . . )

23.2.5 참조.

19.3.39 URIError ( . . . )

20.5.5.6 참조.

19.3.40 WeakMap ( . . . )

24.3.1 참조.

19.3.41 WeakRef ( . . . )

26.1.1 참조.

19.3.42 WeakSet ( . . . )

24.4 참조.

19.4 전역 객체의 기타 프로퍼티

19.4.1 Atomics

25.4 참조.

19.4.2 JSON

25.5 참조.

19.4.3 Math

21.3 참조.

19.4.4 Reflect

28.1 참조.