Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[오타수정] 2.8 기본 연산자와 수학 #1452#1497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cottonpup wants to merge2 commits intojavascript-tutorial:master
base:master
Choose a base branch
Loading
fromcottonpup:1452
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions1-js/02-first-steps/08-operators/article.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,7 +39,7 @@
- 나머지 연산자 `%`,
- 거듭제곱 연산자 `**`

앞쪽 네 연산자는 설명이 필요 없겠지만, `%`와 `**`는 약간의 설명이 필요할 것 같네요.
앞쪽, 네 연산자는 설명이 필요 없겠지만, `%`와 `**`는 약간의 설명이 필요할 것 같네요.

## 나머지 연산자 %

Expand DownExpand Up@@ -200,7 +200,7 @@ alert( +apples + +oranges ); // 5

## 할당 연산자

무언가를 할당할 때 쓰이는 `=`도 연산자입니다. 이 연산자는 할당(assignment)연산자라고 불리는데, 우선순위는 `3`으로 아주 낮습니다.
무언가를 할당할 때 쓰이는 `=`도 연산자입니다. 이 연산자는 할당(assignment)연산자 라고 불리는데, 우선순위는 `3`으로 아주 낮습니다.

`x = 2 * 2 + 1`과 같은 표현식에서 계산이 먼저 이뤄지고, 그 결과가 `x`에 할당되는 이유가 바로 이 때문입니다.

Expand All@@ -216,7 +216,7 @@ alert( x ); // 5

자바스크립트에서 대부분의 연산자들은 값을 반환합니다. `+`와 `-`뿐만 아니라 `=` 역시 값을 반환하죠.

`x = value` 호출하면 `value`가 `x`에쓰여지고, 이에 더하여 *`value`가 반환됩니다*.
`x = value` 호출하면 `value`가 `x`에쓰이고, 이에 더하여 *`value`가 반환됩니다*.

할당 연산자의 이런 특징을 이용한 복잡한 표현식을 살펴봅시다.

Expand DownExpand Up@@ -256,7 +256,7 @@ alert( c ); // 4

이렇게 할당 연산자를 여러 개 연결한 경우, 평가는 우측부터 진행됩니다. 먼저 가장 우측의 `2 + 2`가 평가되고, 그 결과가 좌측의 `c`, `b`, `a`에 순차적으로 할당됩니다. 모든 변수가 단일 값을 공유하게 되죠.

그런데되도록이면 연산자를 체이닝하는것보다 가독성을 위해 아래와 같이 줄을 나눠 코드를 작성하길권유드립니다.
그런데되도록 연산자를 체이닝하는 것보다 가독성을 위해 아래와 같이 줄을 나눠 코드를 작성하길권유해 드립니다.

```js
c = 2 + 2;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp