Skip to content

Commit ad16f7e

Browse files
authored
Merge pull request #595 from ut-code/changing-the-naming-of-annonymous-function
Renamed from originalPrices to pricesWithTax
2 parents eb25395 + adeb3b0 commit ad16f7e

File tree

1 file changed

+3
-3
lines changed
  • docs/2-browser-apps/04-anonymous-function

1 file changed

+3
-3
lines changed

docs/2-browser-apps/04-anonymous-function/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ const add3 = function (a, b) {
8080
このように、他の関数の引数として呼び出される関数のことを<Term>**コールバック関数**</Term>と呼びます。
8181

8282
```javascript
83-
const originalPrices = [100, 200, 300, 400, 500];
83+
const pricesWithoutTax = [100, 200, 300, 400, 500];
8484
const taxRate = 0.1;
85-
const pricesWithTax = originalPrices.map((price) => {
85+
const pricesWithTax = pricesWithoutTax.map((price) => {
8686
return price * (1 + taxRate);
8787
});
8888
document.write(pricesWithTax); // [110, 220, 330, 440, 550]
@@ -107,7 +107,7 @@ document.write(pricesWithTax); // [110, 220, 330, 440, 550]
107107
アロー関数は、内部の処理が `return` 文のみの場合、波括弧を省略して式のみを記述できます。また、引数がひとつだけの場合、引数を囲む括弧を省略できます。前項のサンプルプログラムは、次のように省略可能です。本資料では、前者の省略記法のみを用いることにします。
108108

109109
```javascript
110-
const pricesWithTax = originalPrices.map((price) => price * (1 + taxRate));
110+
const pricesWithTax = pricesWithoutTax.map((price) => price * (1 + taxRate));
111111
```
112112

113113
![アロー関数の省略形](./arrow-function-abbreviation.drawio.svg)

0 commit comments

Comments
 (0)