From 20f86064c723a999d15158d1848cedd92b9ea5cc Mon Sep 17 00:00:00 2001 From: chvmvd <104971044+chvmvd@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:51:22 +0900 Subject: [PATCH] Change to compound assignment operator --- docs/1-trial-session/09-functions/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/1-trial-session/09-functions/index.md b/docs/1-trial-session/09-functions/index.md index 4af260d0e..de9fdb4b7 100644 --- a/docs/1-trial-session/09-functions/index.md +++ b/docs/1-trial-session/09-functions/index.md @@ -93,7 +93,7 @@ function tryToDrive() { let guestCount = 0; function greet() { - guestCount = guestCount + 1; + guestCount += 1; document.write("あなたは" + guestCount + "人目のお客様です。"); } @@ -112,8 +112,8 @@ let outer = 0; function increment() { let inner = 0; - outer = outer + 1; - inner = inner + 1; + outer += 1; + inner += 1; document.write(outer); // 1ずつ増える document.write(inner); // 常に1 }