• 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)中受支持。

  • 相关阅读:
    vue-scroller
    封装toast组件挂载到插件上,仿vux的插件调用toast
    js 滚动加载
    vue
    object.difineProperty
    vue-computed 计算属性
    数组去重
    css布局,左边的滚动时右边不随着滚动
    【洛谷 P5162】 WD与积木(生成函数+NTT)
    【2020省选模拟】题解
  • 原文地址:https://www.cnblogs.com/johnnylion/p/3937511.html
Copyright © 2020-2023  润新知