JavaScript 関数 新しいページはコチラ

提供: yonewiki
移動: 案内, 検索
(定義とオブジェクト化の同時指示)
(呼び出し元取得 caller,constructor)
291行: 291行:
  
 
== 呼び出し元取得 caller,constructor ==
 
== 呼び出し元取得 caller,constructor ==
 +
*function objFuncName1(){ … :document.write(objFuncName1.constructor); … ;}
 +
*function objFuncName1(){ … :document.write(objFuncName1.caller); … ;}
 +
:上記のように関数内で、関数名のプロパティ値constructorおよびcallerの値を出力することで、呼び出し元の関数名を取得することができます。具体的には以下のサンプルのとおりです。
 +
 +
 +
サンプル
 +
<syntaxhighlight lang="javascript" line start="1">
 +
 +
</syntaxhighlight>
 +
[[Media:JavaScript Function caller.html|実行結果サンプル]]
  
 
== 関数オブジェクトからの関数呼び出し call,aplly ==
 
== 関数オブジェクトからの関数呼び出し call,aplly ==

2016年2月22日 (月) 00:00時点における版



個人用ツール
名前空間

変種
操作
案内
ツールボックス