@@ -25,7 +25,7 @@ The above calls `Foo` as constructor and sets the `prototype` of the newly
2525created object to ` Foo.prototype ` .
2626
2727In case of an explicit ` return ` statement, the function returns the value
28- specified that statement, ** but only** if the return value is an ` Object ` .
28+ specified by that statement, but ** only** if the return value is an ` Object ` .
2929
3030 function Bar() {
3131 return 2;
@@ -72,24 +72,24 @@ explicitly return a value.
7272 new Bar();
7373 Bar();
7474
75- Both calls to ` Bar ` return the exact same thing, a newly create object which
76- has a property called ` method ` on it , which is a
75+ Both calls to ` Bar ` return the same thing, a newly create object that
76+ has a property called ` method ` , which is a
7777[ Closure] ( #function.closures ) .
7878
79- It is also to note that the call ` new Bar() ` does ** not** affect the prototype
80- of the returned object. While the prototype will be set on the newly created
81- object, ` Bar ` never returns that new object.
79+ It should also be noted that the call ` new Bar() ` does ** not** affect the
80+ prototype of the returned object. While the prototype will be set on the newly
81+ created object, ` Bar ` never returns that new object.
8282
8383In the above example, there is no functional difference between using and
8484not using the ` new ` keyword.
8585
8686
8787### Creating New Objects via Factories
8888
89- An often made recommendation is to ** not** use ` new ` because forgetting its use
90- may lead to bugs.
89+ It is often recommended to ** not** use ` new ` because forgetting its use may
90+ lead to bugs.
9191
92- In order to create new object, one should rather use a factory and construct a
92+ In order to create a new object, one should rather use a factory and construct a
9393new object inside of that factory.
9494
9595 function Foo() {
@@ -113,16 +113,16 @@ downsides.
113113
114114 1 . It uses more memory since the created objects do ** not** share the methods
115115 on a prototype.
116- 2 . In order to inherit the factory needs to copy all the methods from another
116+ 2 . In order to inherit, the factory needs to copy all the methods from another
117117 object or put that object on the prototype of the new object.
118118 3 . Dropping the prototype chain just because of a left out ` new ` keyword
119- somehow goes against the spirit of the language.
119+ is contrary to the spirit of the language.
120120
121121### In Conclusion
122122
123- While omitting the ` new ` keyword might lead to bugs, it is certainly ** not** a
124- reason to drop the use of prototypes altogether. In the end it comes down to
125- which solution is better suited for the needs of the application, it is
126- especially important to choose a specific style of object creation ** and stick **
127- with it .
123+ While omitting the ` new ` keyword might lead to bugs, it is certainly ** not** a
124+ reason to drop the use of prototypes altogether. In the end it comes down to
125+ which solution is better suited for the needs of the application. It is
126+ especially important to choose a specific style of object creation and use it
127+ ** consistently ** .
128128
0 commit comments