zoukankan      html  css  js  c++  java
  • caller 属性(函数)(JavaScript)

    转载:http://msdn.microsoft.com/zh-cn/library/7t96kt3h(v=vs.94).aspx

    获取调用当前函数的函数。

    functionName.caller

    备注

    functionName 对象是任何正在执行的函数的名称。

    caller 属性只有当函数正在执行时才被定义。 如果函数是从 JavaScript 程序的顶层调用的,则 caller 包含 null。

    如果在字符串上下文中使用 caller 属性,则其结果和 functionName.toString 相同,也就是说,将显示函数的反编译文本。

    下面的示例阐释了 caller 属性的用法:

     1 function CallLevel(){
     2    if (CallLevel.caller == null)
     3       return("CallLevel was called from the top level.");
     4    else
     5       return("CallLevel was called by another function.");
     6 }
     7 
     8 document.write(CallLevel());
     9 
    10 // Output: CallLevel was called from the top level.

    要求

    在以下文档模式中受支持:Quirks、Internet Explorer 6 标准模式、Internet Explorer 7 标准模式、Internet Explorer 8 标准模式、Internet Explorer 9 标准模式、Internet Explorer 10 标准模式和 Internet Explorer 11 标准模式。此外,也在应用商店应用(Windows 8 和 Windows Phone 8.1)中受支持。

  • 相关阅读:
    学习进度条--第十四周
    第二次团队冲刺--9
    第二次团队冲刺--8
    课堂练习--最少花费的购买书籍
    第二次团队冲刺--7
    第二次团队冲刺--6
    第二次团队冲刺--5
    软工第四周进度表
    软工第四周过程总结
    个人作业之二柱子四则运算2升级版
  • 原文地址:https://www.cnblogs.com/johnnylion/p/3937511.html
Copyright © 2011-2022 走看看