From 7819d811c4afda0780bdfb8f453cf6f367203ccd Mon Sep 17 00:00:00 2001 From: Jongha Kim Date: Sun, 4 Jul 2021 21:44:14 +0900 Subject: [ko] fix Javascript Math.tan(), Math.trunc() (#1302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Javascript Math.tan(), Math.trunc() en-us와 동기화 * 리뷰 사항 반영 --- .../reference/global_objects/math/trunc/index.html | 79 +++++++++------------- 1 file changed, 32 insertions(+), 47 deletions(-) (limited to 'files/ko/web/javascript/reference/global_objects/math/trunc/index.html') diff --git a/files/ko/web/javascript/reference/global_objects/math/trunc/index.html b/files/ko/web/javascript/reference/global_objects/math/trunc/index.html index 93375f989f..6bfddf003e 100644 --- a/files/ko/web/javascript/reference/global_objects/math/trunc/index.html +++ b/files/ko/web/javascript/reference/global_objects/math/trunc/index.html @@ -2,38 +2,53 @@ title: Math.trunc() slug: Web/JavaScript/Reference/Global_Objects/Math/trunc translation_of: Web/JavaScript/Reference/Global_Objects/Math/trunc +tags: +- ECMAScript 2015 +- JavaScript +- Math +- Method +- Reference +- Polyfill +browser-compat: javascript.builtins.Math.trunc ---
{{JSRef}}

Math.trunc() 함수는 주어진 값의 소수부분을 제거하고 숫자의 정수부분을 반환합니다.

-

Syntax

+
{{EmbedInteractiveExample("pages/js/math-trunc.html")}}
+ +

구문

Math.trunc(x)
 
-

Parameters

+

매개변수

x
-
숫자형
+
숫자
-

Return value

+

반환 값

주어진 숫자의 정수부분

-

Description

+

설명

-

Math의 유사함수 3개 : {{jsxref("Math.floor()")}}, {{jsxref("Math.ceil()")}} and {{jsxref("Math.round()")}} 와는 다르게, Math.trunc() 함수는 주어진 값이 양수이건 음수이건 상관없이 소수점 이하 우측부분을 제거하는 매우 단순한 동작을 합니다.

+

Math의 다른 함수 3개 {{jsxref("Math.floor()")}}, + {{jsxref("Math.ceil()")}} 그리고 {{jsxref("Math.round()")}} 와는 다르게, + Math.trunc() 단순하게 동작합니다. 함수는 주어진 값이 양수이건 음수이건 상관없이 + 소수점 이하 우측부분을 제거하는 매우 단순한 동작을 합니다.

-

함수인자는 암묵적으로 number형으로 변환되어 메소드에 전달됩니다.

+

함수인자는 암묵적으로 숫자로 변환되어 메서드에 전달됩니다.

-

trunc() 함수는 Math의 정적 메소드이기 때문에 사용자가 생성한 Math 객체의 메소드로 호출하는 것이 아닌 항상 Math.trunc() 형태로 호출해야 합니다. (Math 는 생성자가 아닙니다).

+

trunc() 함수는 Math의 정적 메서드이기 때문에 사용자가 생성한  + Math 객체의 메서드로 호출하는 것이 아닌 항상 Math.trunc() 형태로 + 호출해야 합니다. (Math 는 생성자가 아닙니다).

-

Examples

+

예제

-

Using Math.trunc()

+

Math.trunc()사용하기

Math.trunc(13.37);    // 13
 Math.trunc(42.84);    // 42
@@ -45,43 +60,13 @@ Math.trunc('foo');    // NaN
 Math.trunc();         // NaN
 
-

Polyfill

- -
Math.trunc = Math.trunc || function(x) {
-  if (isNaN(x)) {
-    return NaN;
-  }
-  if (x > 0) {
-    return Math.floor(x);
-  }
-  return Math.ceil(x);
-};
- -

Specifications

- - - - - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('ES2015', '#sec-math.trunc', 'Math.trunc')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-math.trunc', 'Math.trunc')}}{{Spec2('ESDraft')}} 
- -

Browser compatibility

- -

{{Compat("javascript.builtins.Math.trunc")}}

+

표준

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

See also

-- cgit v1.2.3-54-g00ecf