Skip to content

Commit dbc8192

Browse files
authored
ループと関数の並べ替え (#694)
1 parent 435cc92 commit dbc8192

File tree

31 files changed

+53
-116
lines changed

31 files changed

+53
-116
lines changed

docs/1-trial-session/09-functions/_samples/max-no-else/index.html renamed to docs/1-trial-session/08-functions/_samples/max-no-else/index.html

File renamed without changes.

docs/1-trial-session/09-functions/_samples/max-no-else/script.js renamed to docs/1-trial-session/08-functions/_samples/max-no-else/script.js

File renamed without changes.

docs/1-trial-session/09-functions/_samples/max/index.html renamed to docs/1-trial-session/08-functions/_samples/max/index.html

File renamed without changes.

docs/1-trial-session/09-functions/_samples/max/script.js renamed to docs/1-trial-session/08-functions/_samples/max/script.js

File renamed without changes.

docs/1-trial-session/09-functions/_samples/mobile-phone-bill/index.html renamed to docs/1-trial-session/08-functions/_samples/mobile-phone-bill/index.html

File renamed without changes.

docs/1-trial-session/09-functions/_samples/mobile-phone-bill/script.js renamed to docs/1-trial-session/08-functions/_samples/mobile-phone-bill/script.js

File renamed without changes.

docs/1-trial-session/09-functions/_samples/multiply/index.html renamed to docs/1-trial-session/08-functions/_samples/multiply/index.html

File renamed without changes.

docs/1-trial-session/09-functions/_samples/multiply/script.js renamed to docs/1-trial-session/08-functions/_samples/multiply/script.js

File renamed without changes.
File renamed without changes.

docs/1-trial-session/09-functions/index.mdx renamed to docs/1-trial-session/08-functions/index.mdx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,30 @@ function greet() {
127127
document.write("あなたは" + guestCount + "人目のお客様です。");
128128
}
129129

130-
greet();
131-
greet();
130+
greet(); // あなたは1人目のお客様です。
131+
greet(); // あなたは2人目のお客様です。
132132
```
133133

134134
この例における、`greet` <Term>関数</Term>は、呼び出されるたびに `guestCount` に 1 を加えています。
135135

136+
:::tip[複合代入演算子]
137+
138+
[**複合代入演算子**](https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/Expressions_and_Operators#%E4%BB%A3%E5%85%A5%E6%BC%94%E7%AE%97%E5%AD%90) は、計算と代入を同時に行うことができる演算子です。
139+
140+
`x += y` は、`x = x + y` という意味になります。他にも `-=``*=` などの演算子が定義されています。`x -= y``x = x - y``x *= y``x = x * y` という意味になります。
141+
142+
```javascript
143+
guestCount += 1;
144+
```
145+
146+
は以下の文のように読み替えられます。
147+
148+
```javascript
149+
guestCount = guestCount + 1;
150+
```
151+
152+
:::
153+
136154
:::warning[<Term>変数</Term>の<Term>**スコープ**</Term>]
137155

138156
{/* prettier-ignore */}

0 commit comments

Comments
 (0)