Detailed explanation of data types, objects, and constructors in js

零下一度
Release: 2017-07-02 09:20:25
Original
1741 people have browsed it

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

; > Create person object<td class="line-number">
id="
# ## ##
# #lang="en">
## charset=" UTF-8">
aa">

2.创建person构造函数

##
lang="en">
charset="UTF-8">
上机练习二<span class="html-tag">
id=" aa">
##

3.创建person对象原型链

lang="en">
charset="UTF-8">
上机练习三<span class="html-tag">
id=" aa">

4.创建继承person的student子类

lang="en">
charset="UTF-8">
上机练习四<span class="html-tag">
id=" aa">

4. Summary

1. Objects are divided into built-in objects and custom objects

2. The prototype chain is the main method to achieve inheritance

3. The idea of combined inheritance is to use the prototype chain to achieve Inheritance of prototype properties and methods

Welcome to ask questions, point out mistakes, and discuss learning information. If necessary, you can send a private message and post a comment, and everyone can reply

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!