JavaScript data type, object, constructor, prototype object, first introduction to prototype chain, object inheritance
1. Word part
①object parent class②constructor constructor③instance instance④call call
⑤apply application⑥combination combination⑦inheritance inheritance
2. Preview part
1. Briefly describe the two methods of creating objects and the difference between them
new and Literal assignment
The former requires dot.Add properties and methods
The latter calls directly
2. Briefly describe the steps to create an instance using a constructor
①Create a new object
②Assign the scope of the constructor to the new object
③Execute the constructor code block
④Return the new object
3. Briefly describe the role of prototype chain in inheritance
It is the main method to realize inheritance
3. Hands-on part
1. Create person object
;# #lang="en"> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## charset=" | UTF-8"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
aa"> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2.创建person构造函数
|
The above is the detailed content of Detailed explanation of data types, objects, and constructors in js. For more information, please follow other related articles on the PHP Chinese website!