From 2e6c736114686e9eeebab66116426b498ce5a9d2 Mon Sep 17 00:00:00 2001 From: alattalatta Date: Sat, 10 Jul 2021 22:11:56 +0900 Subject: Add arithmetic assignment operators (#1383) * Add addition assignment * Add division assignment * Add exponentiation assignment * Add multiplication assignment * Add subtraction assignment * Sync with English * Add remainder assignment --- .../operators/addition_assignment/index.html | 71 ++++++++++++++++++++++ .../operators/division_assignment/index.html | 55 +++++++++++++++++ .../operators/exponentiation_assignment/index.html | 53 ++++++++++++++++ .../operators/multiplication_assignment/index.html | 51 ++++++++++++++++ .../operators/remainder_assignment/index.html | 52 ++++++++++++++++ .../operators/subtraction_assignment/index.html | 51 ++++++++++++++++ 6 files changed, 333 insertions(+) create mode 100644 files/ko/web/javascript/reference/operators/addition_assignment/index.html create mode 100644 files/ko/web/javascript/reference/operators/division_assignment/index.html create mode 100644 files/ko/web/javascript/reference/operators/exponentiation_assignment/index.html create mode 100644 files/ko/web/javascript/reference/operators/multiplication_assignment/index.html create mode 100644 files/ko/web/javascript/reference/operators/remainder_assignment/index.html create mode 100644 files/ko/web/javascript/reference/operators/subtraction_assignment/index.html diff --git a/files/ko/web/javascript/reference/operators/addition_assignment/index.html b/files/ko/web/javascript/reference/operators/addition_assignment/index.html new file mode 100644 index 0000000000..ca52c6eeef --- /dev/null +++ b/files/ko/web/javascript/reference/operators/addition_assignment/index.html @@ -0,0 +1,71 @@ +--- +title: 더하기 할당 (+=) +slug: Web/JavaScript/Reference/Operators/Addition_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.addition_assignment +translation_of: Web/JavaScript/Reference/Operators/Addition_assignment +--- + +
{{jsSidebar("Operators")}}
+ +

+ 더하기 할당 연산자(+=)는 오른쪽 피연산자의 값을 변수에 더한 결과를 다시 변수에 할당합니다. 두 피연산자의 + 타입이 더하기 할당 연산자의 동작을 결정하며, 덧셈 또는 문자열 연결이 가능합니다. +

+ +
{{EmbedInteractiveExample("pages/js/expressions-addition-assignment.html")}}
+ +

구문

+ +
x += y // x = x + y
+ +

예제

+ +

더하기 할당 사용하기

+ +
+// foo = 'foo'
+// bar = 5
+// baz = true
+// 위와 같은 변수를 가정할 때
+
+// Number + Number -> 덧셈
+bar += 2 // 7
+
+// Boolean + Number -> 덧셈
+baz += 1 // 2
+
+// Boolean + Boolean -> 덧셈
+baz += false // 1
+
+// Number + String -> 연결
+bar += 'foo' // "5foo"
+
+// String + Boolean -> 연결
+foo += false // "foofalse"
+
+// String + String -> 연결
+foo += 'bar' // "foobar"
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

+ + diff --git a/files/ko/web/javascript/reference/operators/division_assignment/index.html b/files/ko/web/javascript/reference/operators/division_assignment/index.html new file mode 100644 index 0000000000..6de3d76281 --- /dev/null +++ b/files/ko/web/javascript/reference/operators/division_assignment/index.html @@ -0,0 +1,55 @@ +--- +title: 나누기 할당 (/=) +slug: Web/JavaScript/Reference/Operators/Division_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.division_assignment +translation_of: Web/JavaScript/Reference/Operators/Division_assignment +--- + +
{{jsSidebar("Operators")}}
+ +

+ 나누기 할당 연산자(/=)는 오른쪽 피연산자의 값으로 변수를 나눈 결과를 다시 변수에 할당합니다. +

+ +
{{EmbedInteractiveExample("pages/js/expressions-division-assignment.html")}}
+ +

구문

+ +
x /= y // x = x / y
+ +

예제

+ +

나누기 할당 사용하기

+ +
+// bar = 5
+// 위와 같은 변수를 가정하고, 아래의 모든 연산을 순서대로 실행할 때
+
+bar /= 2     // 2.5
+bar /= 2     // 1.25
+bar /= 0     // Infinity
+bar /= 'foo' // NaN
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

+ + diff --git a/files/ko/web/javascript/reference/operators/exponentiation_assignment/index.html b/files/ko/web/javascript/reference/operators/exponentiation_assignment/index.html new file mode 100644 index 0000000000..2b741ecff9 --- /dev/null +++ b/files/ko/web/javascript/reference/operators/exponentiation_assignment/index.html @@ -0,0 +1,53 @@ +--- +title: 거듭제곱 할당 (**=) +slug: Web/JavaScript/Reference/Operators/Exponentiation_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.exponentiation_assignment +translation_of: Web/JavaScript/Reference/Operators/Exponentiation_assignment +--- + +
{{jsSidebar("Operators")}}
+ +

+ 거듭제곱 할당 연산자(**=)는 오른쪽 피연산자의 값으로 변수를 거듭제곱한 결과를 다시 변수에 할당합니다. +

+ +
{{EmbedInteractiveExample("pages/js/expressions-exponentiation-assignment.html")}}
+ +

구문

+ +
x **= y // x = x ** y
+ +

예제

+ +

거듭제곱 할당 사용하기

+ +
+// bar = 5
+// 위와 같은 변수를 가정할 때
+
+bar **= 2     // 25
+bar **= 'foo' // NaN
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

+ + diff --git a/files/ko/web/javascript/reference/operators/multiplication_assignment/index.html b/files/ko/web/javascript/reference/operators/multiplication_assignment/index.html new file mode 100644 index 0000000000..cf6916bfe7 --- /dev/null +++ b/files/ko/web/javascript/reference/operators/multiplication_assignment/index.html @@ -0,0 +1,51 @@ +--- +title: 곱하기 할당 (*=) +slug: Web/JavaScript/Reference/Operators/Multiplication_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.multiplication_assignment +translation_of: Web/JavaScript/Reference/Operators/Multiplication_assignment +--- + +
{{jsSidebar("Operators")}}
+ +

곱하기 할당 연산자(*=)는 오른쪽 피연산자의 값을 변수에 곱한 결과를 다시 변수에 할당합니다.

+ +
{{EmbedInteractiveExample("pages/js/expressions-multiplication-assignment.html")}}
+ +

구문

+ +
x *= y // x = x * y
+ +

예제

+ +

곱하기 할당 사용하기

+ +
+// bar = 5
+// 위와 같은 변수를 가정할 때
+
+bar *= 2     // 10
+bar *= 'foo' // NaN
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

+ + diff --git a/files/ko/web/javascript/reference/operators/remainder_assignment/index.html b/files/ko/web/javascript/reference/operators/remainder_assignment/index.html new file mode 100644 index 0000000000..013dce4cb0 --- /dev/null +++ b/files/ko/web/javascript/reference/operators/remainder_assignment/index.html @@ -0,0 +1,52 @@ +--- +title: 나머지 할당 (%=) +slug: Web/JavaScript/Reference/Operators/Remainder_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.remainder_assignment +translation_of: Web/JavaScript/Reference/Operators/Remainder_assignment +--- + +
{{jsSidebar("Operators")}}
+ +

나머지 할당 연산자(%=)는 오른쪽 피연산자의 값으로 변수를 나눴을 때의 나머지를 다시 변수에 할당합니다.

+ +
{{EmbedInteractiveExample("pages/js/expressions-remainder-assignment.html")}}
+ +

구문

+ +
x %= y // x = x % y
+ +

예제

+ +

나머지 할당 사용하기

+ +
+// bar = 5
+// 위와 같은 변수를 가정할 때
+
+bar %= 2     // 1
+bar %= 'foo' // NaN
+bar %= 0     // NaN
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

+ + diff --git a/files/ko/web/javascript/reference/operators/subtraction_assignment/index.html b/files/ko/web/javascript/reference/operators/subtraction_assignment/index.html new file mode 100644 index 0000000000..53ea2d0174 --- /dev/null +++ b/files/ko/web/javascript/reference/operators/subtraction_assignment/index.html @@ -0,0 +1,51 @@ +--- +title: 빼기 할당 (-=) +slug: Web/JavaScript/Reference/Operators/Subtraction_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.subtraction_assignment +translation_of: Web/JavaScript/Reference/Operators/Subtraction_assignment +--- + +
{{jsSidebar("Operators")}}
+ +

빼기 할당 연산자(-=)는 오른쪽 피연산자의 값을 변수에서 뺀 결과를 다시 변수에 할당합니다.

+ +
{{EmbedInteractiveExample("pages/js/expressions-subtraction-assignment.html")}}
+ +

구문

+ +
x -= y // x = x - y
+ +

예제

+ +

빼기 할당 사용하기

+ +
+// bar = 5
+// 위와 같은 변수를 가정할 때
+
+bar -= 2     // 3
+bar -= 'foo' // NaN
+
+ +

명세

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

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