Water Sunlight

軽量プログラミングの文法 - JavaScript/Python

ユーザ用ツール

サイト用ツール


js:function:basic

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
js:function:basic [2021/04/19 13:02]
tanaka [Functionコンストラクタ]
js:function:basic [2021/04/19 13:05] (現在)
tanaka [第1級オブジェクト]
行 53: 行 53:
 </code> </code>
  
-=== 例 === +<sxh javascript;title:Example>
-<code javascript>+
 var func = function(height, width) { var func = function(height, width) {
     return height * width;     return height * width;
 }; };
 console.log(func(10, 20));  // 結果:200 console.log(func(10, 20));  // 結果:200
-</code>+</sxh>
  
 関数リテラルは、無名関数又は匿名関数とも呼ばれる。 関数リテラルは、無名関数又は匿名関数とも呼ばれる。
行 74: 行 73:
 </code> </code>
  
-=== 例1 === +<sxh javascript;title:Example>
-<code javascript>+
 var func = (height, width) => { var func = (height, width) => {
     return height * widht;     return height * widht;
 }; };
 console.log(func(10, 20)); console.log(func(10, 20));
-</code>+</sxh>
  
-=== 例2:括弧の省略 === +<sxh javascript;title:Example 括弧の省略>
-<code javascript>+
 var area = r => Math.PI * r * r; var area = r => Math.PI * r * r;
 console.log(area(10)); console.log(area(10));
-</code>+</sxh>
  
-=== 例3:引数無し === +<sxh javascript;title:Example 引数無し>
-<code javascript>+
 var sayHello = () => console.log('Hello'); var sayHello = () => console.log('Hello');
 sayHello(); sayHello();
-</code>+</sxh>
 \\ \\
  
行 104: 行 100:
   * 独自の存在をもつ(無名可能)   * 独自の存在をもつ(無名可能)
  
-=== 例 === +<sxh javascript;title:Example>
-<code javascript>+
 function func1(height, width){return height * width} function func1(height, width){return height * width}
                  
行 120: 行 115:
 callFunc(3, 10, func3);  // 結果:30 callFunc(3, 10, func3);  // 結果:30
 callFunc(4, 10, func4);  // 結果:40 callFunc(4, 10, func4);  // 結果:40
-</code>+</sxh>
js/function/basic.1618804963.txt.gz · 最終更新: 2021/04/19 13:02 by tanaka