zoukankan      html  css  js  c++  java
  • 关于JavaScript中[native code]

    关于JavaScript中[native code]

    一、总结

    一句话总结:

    1、[native code] 意思已经很明确了:是 native 的代码实现的 built-in 函数,而不是 JavaScript 代码
    2、An implementation-dependent representation of the function is returned.

    二、关于JavaScript中[native code]

    转自或参考:

    [native code] 意思已经很明确了:是 native 的代码实现的 built-in 函数,而不是 JavaScript 代码。

    但这并不是语言标准规定的。只是恰好 Firefox、Chrome 都这么干而已。

    语言标准里有说:

    15.2.4.2 Function.prototype.toString()


    An implementation-dependent representation of the function is returned.

    它是 implementation-dependent 的。

    说到 V8,可以看 v8natives.js 第 1710 行附近的 FunctionSourceString 函数:
    return 'function () { [native code] }';
    
    这就是 V8 是怎么返回 [native code] 这一串字符串的。



     
  • 相关阅读:
    python3 pyinstaller
    python3 random
    python3 turtle
    产生一个序列的所有排列组合
    蒙特卡洛算法
    lightoj 1014
    UVA11426
    nginx 配置本地https(免费证书)
    ElementUI
    Airbnb 代码规范
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/12683554.html
Copyright © 2011-2022 走看看