ECMAScript is a highly abstract object-oriented language.
ECMAScript is a highly abstract object-oriented language used to process Objects. Of course, there are also basic types, but if necessary, you also need to convert them into object objects for use.
An object is a collection of properties and has a single prototype object. The prototype may be either an object or the null value.
An Object is a set of attributes and has a separate prototype object [prototype object]. This prototype object [prototype Object] can be an object or a null value.
Let's take an example of a basic Object. First, we need to know that the prototype of an Object is a reference to the internal [prototype] attribute.
But in general, we will use __ <内部属性名> _ Underline to replace double parentheses, such as _ proto _ (this is the implementation of prototype concepts by some script engines such as SpiderMonkey, although not standard ).
var foo = { x: 10, y: 20};
The above code foo object has two explicit attributes: [explicit own properties] and an implicit _ proto _ attribute [implicit _ proto _ property]. the prototype pointing to foo.
A basic object containing a prototype
Why is prototype required? Let's consider the concept of prototype chain to answer this question.
Additional reading
The topic list of this article is as follows:
- How should we understand the working principle of the JavaScript engine?
- JavaScript exploration: the importance of writing maintainable code
- JavaScript exploration: exercise caution when using global variables
- JavaScript exploration: var pre-parsing and side effects
- JavaScript exploration: for Loop (for Loops)
- JavaScript exploration: for-in loop (for-in Loops)
- Exploring JavaScript: Prototypes is too powerful
- JavaScript: eval () is the devil"
- JavaScript exploration: Using parseInt () for Numerical Conversion
- Exploring JavaScript: Basic coding specifications
- JavaScript exploration: function declaration and function expression
- JavaScript exploration: Name function expressions
- JavaScript: function name in the debugger
- JavaScript: JScript Bug
- JavaScript exploration: Memory Management of JScript
- Exploring JavaScript: SpiderMonkey's quirks
- JavaScript exploration: an alternative solution to naming function expressions
- JavaScript exploration: Object
- JavaScript exploration: Prototype chain
- JavaScript exploration: Constructor
- JavaScript probing: executable context Stack
- Execution context 1: Variable object and activity object
- Execution context 2: Scope chain Scope Chains
- Execution context 3: Closure Closures
- Execution context 4: This pointer
- Exploring JavaScript: Powerful prototype and prototype chain
- JavaScript Functions 1: function declaration
- JavaScript function 2: function expressions
- JavaScript function 3: function expressions in a group
- JavaScript function 4: function Constructor
- JavaScript variable object 1: VO Declaration
- JavaScript variable object 2: VO in different execution contexts
- JavaScript variable object 3: two stages of execution Context
- JavaScript variable object IV: Variables
- Property of the JavaScript variable object __parent _
- JavaScript scope chain 1: Scope chain Definition
- JavaScript scope chain 2: function Lifecycle
- JavaScript scope chain 3: Scope chain features
- JavaScript closure 1: Introduction to closures
- JavaScript closure 2: Implementation of closure
- JavaScript closure 3: Closure usage
This article is available at http://www.nowamagic.net/librarys/veda/detail/1640.