一、总结

一句话总结:

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

 

 

 

二、关于JavaScript中[native code]

转自或参考:

 

关于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,可以看
return 'function () { [native code] }';
这就是 V8 是怎么返回 [native code] 这一串字符串的。



相关文章:

  • 2022-12-23
  • 2021-12-20
  • 2021-11-25
  • 2022-12-23
  • 2021-09-02
  • 2022-03-10
  • 2021-07-18
猜你喜欢
  • 2021-10-24
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2022-01-22
  • 2021-11-04
  • 2022-12-23
相关资源
相似解决方案