本文介绍了什么是ECMAScript“原生对象”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据原生对象

内置对象定义为

带注释

如果本机对象是完全对象由ECMA-262规范而不是主机环境定义,ECMAScript实现可以指定和定义新的内置对象,如果这些新的内置对象未被ECMA完全定义,它们如何可以是本机对象 - 262规格?

If a native object is fully defined by the ECMA-262 specification rather than the host environment and an ECMAScript implementation may specify and define new built-in objects, how is it that these new built-in object's can be native objects when they are not fully defined by the ECMA-262 specification?

我缺少什么?

推荐答案

他们'重新原生,因为它们带有ECMAScript 实现。主机环境通常是由ECMAScript实现和其他几个协同工作的应用程序组成的应用程序。例如,

They're "native" because they come with the ECMAScript implementation. A host environment in generally an application consisting of an ECMAScript implementation and several other interfaces that work together. For instance,


  • 网络浏览器—主机环境由ECMAScript实现,DOM接口,渲染引擎,UI等组成。

  • Windows脚本宿主—主机环境由ECMAScript实现,VBScript实现等组成。

  • Node.js —由ECMAScript实现(V8),HTTP接口等组成的主机环境

  • Web Browser — a host environment consisting of ECMAScript implementation, DOM interface, Rendering engine, UI, etc.
  • Windows Script Host — a host environment consisting of ECMAScript implementation, VBScript implementation, etc.
  • Node.js — a host environment consisting of ECMAScript implementation (V8), HTTP interfaces, etc.

内置对象必需继承自对象功能,而主机对象—主机环境提供的对象,但不一定在执行开始时出现—不需要,但可能(有时也可以)。

"Built-in" objects are required to inherit from Object or Function, whereas host objects — objects provided by the host environment, but not necessarily present at the start of execution — are not required to but may (and sometimes do).


  • 对象()数组()日期( )

  • 数学 JSON ,全局对象。

  • Object(), Array(), Date()
  • Math, JSON, the Global object.

  • Mozilla的众多JavaScript扩展—例如或

  • JScript的构造函数和(未记录的) function

  • Mozilla's numerous JavaScript extensions — such as WeakMap() or __proto__
  • JScript's ActiveXObject() constructor and (undocumented) CollectGarbage() function

  • DOM对象, 文件窗口

  • console

  • DOM objects, document and window
  • console

这篇关于什么是ECMAScript“原生对象”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 23:13