caller

2 位贡献者:

已废弃
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

概述

返回调用当前正在执行的函数的函数.

Property of arguments
Implemented in JavaScript 1.1
ECMAScript Edition None

描述

该属性已经不可用, 请使用Function.caller代替.

示例

下例演示了arguments.caller属性的作用.

function whoCalled() {
   if (arguments.caller == null)
      console.log('该函数在全局作用域内被调用.');
   else
      console.log(arguments.caller + '调用了我!');
}

文档标签和贡献者

向此页面作出贡献: teoli, ziyunfei
最后编辑者: teoli,