From ccb900b041418e2b62bea19efd97de7861692156 Mon Sep 17 00:00:00 2001 From: Dilrong Date: Fri, 16 Jul 2021 12:37:49 +0900 Subject: bad_radix 동기화 및 번역 (#1382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 이학성 --- .../reference/errors/bad_radix/index.html | 46 +++++++--- .../global_objects/bigint/tostring/index.html | 102 +++++++++++++++++++++ 2 files changed, 135 insertions(+), 13 deletions(-) create mode 100644 files/ko/web/javascript/reference/global_objects/bigint/tostring/index.html (limited to 'files/ko/web/javascript') diff --git a/files/ko/web/javascript/reference/errors/bad_radix/index.html b/files/ko/web/javascript/reference/errors/bad_radix/index.html index 3ea98bf1eb..15db6a1c7c 100644 --- a/files/ko/web/javascript/reference/errors/bad_radix/index.html +++ b/files/ko/web/javascript/reference/errors/bad_radix/index.html @@ -1,25 +1,44 @@ --- title: 'RangeError: radix must be an integer' slug: Web/JavaScript/Reference/Errors/Bad_radix +tags: +- Error +- Errors +- JavaScript +- RangeError translation_of: Web/JavaScript/Reference/Errors/Bad_radix ---
{{jsSidebar("Errors")}}
-

메시지

+

JavaScript 예외 "radix must be an integer at least 2 and no greater than 36"는 + {{jsxref("Number.prototype.toString()")}} 또는 {{jsxref("BigInt.prototype.toString()")}} + 메서드의 선택적 매개 변수가 지정된 경우 2에서 36 사이여야 합니다. +

-
RangeError: radix must be an integer at least 2 and no greater than 36 (Firefox)
-RangeError: toString() radix argument must be between 2 and 36 (Chrome)
-
+

메시지

+ +
RangeError: invalid argument (Edge)
+    RangeError: radix must be an integer at least 2 and no greater than 36 (Firefox)
+    RangeError: toString() radix argument must be between 2 and 36 (Chrome)
+    
-

에러 형식

+

에러 형식

{{jsxref("RangeError")}}

-

무엇이 잘못되었을까?

+

무엇이 잘못되었을까?

-

{{jsxref("Number.prototype.toString()")}} 메소드는 선택적 파라메터인 radix(기수:진수를 지정하는 값)와 함께 사용되어 왔습니다. 이 파라메터는 반드시 수의 값을 나타내는 진법의 2와 36 사이로 지정된 정수(숫자)여야 합니다. 

+

{{jsxref("Number.prototype.toString()")}} 또는 + {{jsxref("BigInt.prototype.toString()")}} + 메서드는 선택적 파라미터인 radix(기수: 진수를 지정하는 값)와 함게 사용되어 왔습니다. + 이 파라미터는 반드시 수의 값을 나타내는 진법 2와 36 사이로 지정된 정수(숫자)여야 합니다. +

-

왜 36으로 제한이 되었을까요? radix는 digit(밑기수) 알파벳 글자로 사용되는 10보다는 큽니다. 그렇기 때문에, radix는 라틴 알파벳 26글자를 가졌을 때, 36보다 클 수 없습니다.  

+

+ 이 매개 변수의 값이 36으로 제한된 이유는 무엇일까요? + 10보다 큰 기수는 알파벳 문자를 숫자로 사용하기 때문입니다. + 따라서 기수는 36을 초과할 수 없습니다. 라틴 알파벳(영어와 다른 많은 언어에서 사용됨)은 26자뿐이기 때문입니다. +

보통 아래의 radix 중 하나를 사용하게 될 것입니다.

@@ -30,9 +49,9 @@ RangeError: toString() radix argument must be between 2 and 36 (Chrome)
  • 16 for hexadecimal numbers (16진수).
  • -

    +

    예제

    -

    허용되지 않는 경우

    +

    허용되지 않는 경우

    (42).toString(0);
     (42).toString(1);
    @@ -42,7 +61,7 @@ RangeError: toString() radix argument must be between 2 and 36 (Chrome)
     (12071989).toString("MM-dd-yyyy");
     
    -

    허용된 경우

    +

    허용된 경우

    (42).toString(2);     // "101010" (2진수)
     (13).toString(8);     // "15"     (8진수)
    @@ -50,8 +69,9 @@ RangeError: toString() radix argument must be between 2 and 36 (Chrome)
     (100000).toString(16) // "186a0"  (16진수)
     
    -

    참조

    +

    또 다른 내용

    diff --git a/files/ko/web/javascript/reference/global_objects/bigint/tostring/index.html b/files/ko/web/javascript/reference/global_objects/bigint/tostring/index.html new file mode 100644 index 0000000000..3b04cd9f84 --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/bigint/tostring/index.html @@ -0,0 +1,102 @@ +--- +title: BigInt.prototype.toString() +slug: Web/JavaScript/Reference/Global_Objects/BigInt/toString +tags: +- BigInt +- JavaScript +- Method +- Prototype +- toString() +browser-compat: javascript.builtins.BigInt.toString +--- +
    {{JSRef}}
    + +

    The toString() method returns a string representing the + specified {{jsxref("BigInt")}} object. The trailing "n" is not part of the string.

    + +
    {{EmbedInteractiveExample("pages/js/bigint-tostring.html")}}
    + +

    Syntax

    + +
    +toString()
    +toString(radix)
    +
    + +

    Parameters

    + +
    +
    radix{{optional_inline}}
    +
    Optional. An integer in the range 2 through 36 specifying the base to use for + representing numeric values.
    +
    + +

    Return value

    + +

    A string representing the specified {{jsxref("BigInt")}} object.

    + +

    Exceptions

    + +
    +
    {{jsxref("RangeError")}}
    +
    If toString() is given a radix less than 2 or greater than 36, a + {{jsxref("RangeError")}} is thrown.
    +
    + +

    Description

    + +

    The {{jsxref("BigInt")}} object overrides the toString() method of the + {{jsxref("Object")}} object; it does not inherit + {{jsxref("Object.prototype.toString()")}}. For {{jsxref( "BigInt")}} objects, the + toString() method returns a string representation of the object in the + specified radix.

    + +

    The toString() method parses its first argument, and attempts to return a + string representation in the specified radix (base). For radixes above 10, the letters + of the alphabet indicate numerals greater than 9. For example, for hexadecimal numbers + (base 16) a through f are used.

    + +

    If the radix is not specified, the preferred radix is assumed to be 10. +

    + +

    If the bigIntObj is negative, the sign is preserved. This is the case even + if the radix is 2; the string returned is the positive binary representation of the + bigIntObj preceded by a - sign, not the two's + complement of the bigIntObj.

    + +

    Examples

    + +

    Using toString

    + +
    17n.toString();      // '17'
    +66n.toString(2);     // '1000010'
    +254n.toString(16);   // 'fe'
    +-10n.toString(2);    // -1010'
    +-0xffn.toString(2);  // '-11111111'
    +
    + +

    Negative-zero BigInt

    + +

    There is no negative-zero BigInt as there are no negative zeros in + integers. -0.0 is an IEEE floating-point concept that only appears in the + JavaScript {{jsxref("Number")}} type.

    + +
    (-0n).toString();      // '0'
    +BigInt(-0).toString(); // '0'
    + +

    Specifications

    + +{{Specifications}} + +

    Browser compatibility

    + + +

    {{Compat}}

    + +

    See also

    + + -- cgit v1.2.3-54-g00ecf