javascript-在ECMAScript中,某些本地对象也是如何内置的?
作者:互联网
我想需要一个本地对象和内置对象的定义才能回答这个问题. ECMAScript规范将这些定义为:
4.3.6 native object
object in an ECMAScript implementation, independent of the host environment, that is present at the start of
the execution of an ECMAScript program.NOTE Standard native built-in objects are defined in this
specification. Some native objects are built-in; others may be
constructed during the course of execution of an ECMAScript program4.3.7 built-in object
object supplied by an ECMAScript implementation, independent of the host environment, that is present
at the start of the execution of an ECMAScript programNOTE Standard built-in objects are defined in this specification,
and an ECMAScript implementation may specify and define others. Every
built-in object is a native object. A built-in constructor is a
built-in object that is also a constructor.
我期待对此的解释.
解决方法:
这是ES5 shows:
4.3.6
native object # Ⓣ
object in an ECMAScript implementation whose semantics are fully defined by this specification rather than by the host environment.NOTE Standard native objects are defined in this specification. Some native objects are built-in; others may be constructed during the course of execution of an ECMAScript program.
4.3.7
built-in object # Ⓣ
object supplied by an ECMAScript implementation, independent of the host environment, that is present at the start of the execution of an ECMAScript program.NOTE Standard built-in objects are defined in this specification, and an ECMAScript implementation may specify and define others. Every built-in object is a native object. A built-in constructor is a built-in object that is also a constructor.
如您所见,与您所显示的有所不同.
内置对象是兼容ECMAScript的引擎提供的本机对象.例如:
>字符串
>对象
>阵列
>未定义
>布尔
>等
本机对象例如是:
var obj = {};
或之前显示的列表.内置对象是本机的.
另外,您没有显示它,但是宿主对象是依赖于环境的对象.例如,在浏览器中,宿主对象是window.但是,还有其他主机对象,例如document或XMLHttpRequest.
标签:javascript,ecmascript-5 来源: https://codeday.me/bug/20191011/1894457.html