This commit is contained in:
Ilya Kantor 2017-03-30 13:28:35 +03:00
parent bc9117e70f
commit 79f3775034
7 changed files with 89 additions and 75 deletions

View file

@ -2,7 +2,7 @@ importance: 2
---
# Two functions -- one object
# Two functions one object
Is it possible to create functions `A` and `B` such as `new A()==new B()`?

View file

@ -1,4 +1,4 @@
# Constructor, operator "new"
# Constructor, operator "new"
The regular `{...}` syntax allows to create one object. But often we need to create many similar objects.
@ -210,4 +210,10 @@ john = {
We can use constructor functions to make multiple similar objects. But the topic is much deeper than described here. So we'll return it later and cover more in-depth.
As of now, it's important to understand what `new` is, because JavaScript provides constructor functions for many built-in language objects: like `Date` for dates, `Set` for sets and others that we plan to study.
JavaScript provides constructor functions for many built-in language objects: like `Date` for dates, `Set` for sets and others that we plan to study.
```smart header="Objects, we'll be back!"
In this chapter we only cover the basics about objects. They are essential for learning more about data types and functions in the next chapters.
After the learn that, in the chapter <info:object-oriented-programming> we return to objects and cover them in-depth, including inheritance and classes.
```