From 9358d5be7f62495bc426ddcd839e17ebdc741e6b Mon Sep 17 00:00:00 2001 From: Jongha Kim Date: Mon, 12 Jul 2021 23:04:21 +0900 Subject: Add unary operators (#1385) * Add unary operators * Update files/ko/web/javascript/reference/operators/unary_plus/index.html Co-authored-by: hochan Lee * Update files/ko/web/javascript/reference/operators/unary_plus/index.html Co-authored-by: hochan Lee * Update files/ko/web/javascript/reference/operators/unary_negation/index.html Co-authored-by: alattalatta * Update files/ko/web/javascript/reference/operators/unary_plus/index.html * Update files/ko/web/javascript/reference/operators/unary_negation/index.html Co-authored-by: hochan Lee Co-authored-by: alattalatta --- .../reference/operators/unary_negation/index.html | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 files/ko/web/javascript/reference/operators/unary_negation/index.html (limited to 'files/ko/web/javascript/reference/operators/unary_negation/index.html') diff --git a/files/ko/web/javascript/reference/operators/unary_negation/index.html b/files/ko/web/javascript/reference/operators/unary_negation/index.html new file mode 100644 index 0000000000..46f8f01f48 --- /dev/null +++ b/files/ko/web/javascript/reference/operators/unary_negation/index.html @@ -0,0 +1,64 @@ +--- +title: 단항 부정 (-) +slug: Web/JavaScript/Reference/Operators/Unary_negation +tags: +- JavaScript +- Language feature +- Operator +- Reference +browser-compat: javascript.operators.unary_negation +--- +
{{jsSidebar("Operators")}}
+ +

단항 부정 연산자(-)는 피연산자 앞에 위치하며, 피연산자의 부호를 부정합니다. 즉 양수는 음수로, 음수는 양수로 바꿉니다.

+ +
{{EmbedInteractiveExample("pages/js/expressions-unary-negation.html")}}
+ + +

구문

+ +
-x
+
+ +

예제

+ +

숫자 부정하기

+ +
const x = 3;
+const y = -x;
+
+// y = -3
+// x = 3
+
+ +

숫자가 아닌 값을 부정하기

+ +

단항 부정 연산자는 숫자가 아닌 값을 숫자로 변환할 수 있습니다.

+ +
const x = "4";
+const y = -x;
+
+// y = -4
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

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