From c581ac7c5b0ba9552a0e34f467c4f62050e0c455 Mon Sep 17 00:00:00 2001 From: DevJo Date: Mon, 13 Dec 2021 19:50:12 +0900 Subject: remove: notranslate in web/javascript/reference/global_objects --- .../reference/global_objects/object/valueof/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'files/ko/web/javascript/reference/global_objects/object') diff --git a/files/ko/web/javascript/reference/global_objects/object/valueof/index.html b/files/ko/web/javascript/reference/global_objects/object/valueof/index.html index cb8e14c16d..4d291a8115 100644 --- a/files/ko/web/javascript/reference/global_objects/object/valueof/index.html +++ b/files/ko/web/javascript/reference/global_objects/object/valueof/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf

구문

-
object.valueOf()
+
object.valueOf()

반환 값

@@ -43,13 +43,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf

MyNumberType이라는 객체 형태가 존재하고, 이 객체의 valueOf 메서드를 만들고 싶다고 가정하겠습니다. 다음의 코드는 객체의 valueOf 메서드에 사용자 정의 함수를 할당합니다.

-
MyNumberType.prototype.valueOf = function() { return customPrimitiveValue; };
+
MyNumberType.prototype.valueOf = function() { return customPrimitiveValue; };

위의 코드가 활성화된 상태에서 어떤 MyNumberType 객체를 원시 값으로 표현해야 하면 JavaScript가 자동으로 저 함수를 실행합니다.

이 객체의 valueOf 메서드는 보통 JavaScript가 호출하겠지만 다음처럼 직접 호출할 수도 있습니다.

-
myNumberType.valueOf()
+
myNumberType.valueOf()

참고: 문자열 문맥에서 객체-문자열 변환은 {{jsxref("Object.toString", "toString()")}} 메서드를 사용하며, {{jsxref("String")}} 객체의 valueOf를 사용해 원시 문자열로 변환하는 것과는 다릅니다. 모든 객체는, 비록 결과가 "[object type]" 뿐이라도 문자열 변환 기능을 가지고 있습니다. 그러나 대다수의 객체는 숫자, 불리언, 함수 등으로 변환되지 않습니다.

@@ -59,7 +59,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Object/valueOf

커스텀 타입에 valueOf 사용하기

-
function MyNumberType(n) {
+
function MyNumberType(n) {
     this.number = n;
 }
 
@@ -72,7 +72,7 @@ myObj + 3; // 7

단항 더하기 사용하기

-
+"5" // 5 (string to number)
+
+"5" // 5 (string to number)
 +"" // 0 (string to number)
 +"1 + 2" // NaN (doesn't evaluate)
 +new Date() // same as (new Date()).getTime()
-- 
cgit v1.2.3-54-g00ecf