From 0baea273f37aab6ad45b61b3d27720b69fdedf07 Mon Sep 17 00:00:00 2001 From: frgd Date: Mon, 25 Sep 2023 17:13:43 +0900 Subject: [PATCH 01/43] =?UTF-8?q?Bandwidth=E3=81=AF=E5=B8=AF=E5=9F=9F?= =?UTF-8?q?=E5=B9=85=E3=81=A7=E3=81=82=E3=82=8A=E3=80=81=E9=80=9A=E4=BF=A1?= =?UTF-8?q?=E9=87=8F=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/1-trial-session/09-functions/index.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/1-trial-session/09-functions/index.md b/docs/1-trial-session/09-functions/index.md index 64b33cc84..96f278891 100644 --- a/docs/1-trial-session/09-functions/index.md +++ b/docs/1-trial-session/09-functions/index.md @@ -107,18 +107,19 @@ increment(); 携帯電話料金を計算する関数を作ってみましょう。 ```javascript -function calculateCost(monthlyBandwidth) { +function calculateCost(monthlyDataUse) { // ここに処理を書く } document.write(calculateCost(3.5)); ``` -`calculateCost` は、引数に月間転送量 `monthlyBandwidth` を取り、その月の携帯電話料金を戻り値として返す関数です。携帯電話料金は、下のルールで決定されるとします。 +`calculateCost` は、引数に月間転送量 `monthlyDataUse` を取り、その月の携帯電話料金を戻り値として返す関数です。携帯電話料金は、下のルールで決定されるとします。 -> 月間転送量を _monthlyBandwidth_ (GB) とします。 + +> +> - 月間転送量 < 5.0 (GB) のとき、携帯電話料金は 月間転送量 × 600 (円/GB) +> - 月間転送量 >= 5.0 (GB) のとき、携帯電話料金は 3000 (円) > -> - _monthlyBandwidth_ < 5.0 のとき、携帯電話料金は _monthlyBandwidth_ × 600 (円) -> - _monthlyBandwidth_ >= 5.0 のとき、携帯電話料金は 3000 (円) From 157933e5c85cb91ffcc412cbf679f6271ab5a166 Mon Sep 17 00:00:00 2001 From: frgd Date: Mon, 25 Sep 2023 18:07:55 +0900 Subject: [PATCH 02/43] =?UTF-8?q?return=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=88=86=E5=B2=90=E3=81=AE=E8=AA=AC=E6=98=8E?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/1-trial-session/09-functions/index.md | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/1-trial-session/09-functions/index.md b/docs/1-trial-session/09-functions/index.md index 96f278891..3a525bb09 100644 --- a/docs/1-trial-session/09-functions/index.md +++ b/docs/1-trial-session/09-functions/index.md @@ -59,7 +59,25 @@ document.write(add(3, 4)); 上の例の 4 行目で、 `add(3, 4)` が評価されると、 `a = 3, b = 4` として `add` 関数が実行されます。`add`関数の中で `return a + b;` が実行されると、 `a + b` が評価され、`7` になります。これにより、 `add` 関数は `7` を返し `add(3, 4)` の評価結果は `7` となります。 -