Skip to content

Commit dcf4b5b

Browse files
committed
closes #2619
1 parent 581117f commit dcf4b5b

File tree

1 file changed

+3
-3
lines changed
  • 1-js/04-object-basics/06-constructor-new

1 file changed

+3
-3
lines changed

1-js/04-object-basics/06-constructor-new/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ Now if we want to create other users, we can call `new User("Ann")`, `new User("
6464

6565
That's the main purpose of constructors -- to implement reusable object creation code.
6666

67-
Let's note once again -- technically, any function can be used as a constructor. That is: any function can be run with `new`, and it will execute the algorithm above. The "capital letter first" is a common agreement, to make it clear that a function is to be run with `new`.
67+
Let's note once again -- technically, any function (except arrow functions, as they don't have `this`) can be used as a constructor. It can be run with `new`, and it will execute the algorithm above. The "capital letter first" is a common agreement, to make it clear that a function is to be run with `new`.
6868

6969
````smart header="new function() { ... }"
70-
If we have many lines of code all about creation of a single complex object, we can wrap them in constructor function, like this:
70+
If we have many lines of code all about creation of a single complex object, we can wrap them in an immediately called constructor function, like this:
7171
7272
```js
7373
let user = new function() {
@@ -80,7 +80,7 @@ let user = new function() {
8080
};
8181
```
8282
83-
The constructor can't be called again, because it is not saved anywhere, just created and called. So this trick aims to encapsulate the code that constructs the single object, without future reuse.
83+
This constructor can't be called again, because it is not saved anywhere, just created and called. So this trick aims to encapsulate the code that constructs the single object, without future reuse.
8484
````
8585

8686
## Constructor mode test: new.target

0 commit comments

Comments
 (0)