Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
140 views
in Technique[技术] by (71.8m points)

javascript - What Internal Property In ECMAScript is defined for?

What the Internal Property in ECMAScript is defined for ? What does the spec mean by

This specification uses various internal properties to define the semantics of object values.These internal properties are not part of the ECMAScript language. They are defined by this specification purely for expository purposes.

Does it mean that Internal properties defined by ECMAScript are not available for programming. They are used in the implementation of the javascript engine ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Internal properties define the behavior of code as it executes but are not accessible via code. ECMAScript defines many internal properties for objects in JavaScript. Internal properties are indicated by double-square-bracket notation.

For example, JavaScript function is an object and it has [[call]] property. [[call]] property is unique to function.

Another internal property example is [[prototype]] property. This property is a pointer pointing back to the prototype object that the instance is using. Since internal property cannot be accessed via code, an object instantiation cannot access to the prototype while its properties are all available to the object. You can get the value of [[prototype]] property by using Object.getPrototypeOf() method on an object.

var obj = new Object();
var prototype = Object.getPrototypeOf(obj);
console.log(prototype == Object.prototype);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...