You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`this`, `bind`, `call`, `apply`, `class`, `prototype`, `super`, `new`, `extends`, `Object.create`, `Object.setPrototypeOf`, `Object.getPrototypeOf`, `__proto__`, `instanceof`, `typeof`, `.prototype.isPrototypeOf` The mental overhead is there. The question "what is this in js" has millions of views, which hints at a source of confusion.
8
8
9
9
### Not transferrable in between realms
10
10
11
-
Web Worker, Local Storage, Browser, Server. An instance of a class transferred will lose its prototype chain. In order to use the class methods with the instance one has to reinstanciate which requires extra code compared to the plain object alternative.
11
+
Web Worker, Local Storage, Browser, Server. An instance of a class transferred will lose its prototype chain. In order to use the class methods with the instance one has to re-instantiate which requires extra code compared to the plain object alternative.
12
12
13
-
### Compatibilty with higher-order functions
13
+
### Compatibility with higher-order functions
14
14
15
-
It is harder to use higher-order function with the class keyword than it is with regular functions. Regular functions can be mixed, composed, curried etc. Overall it results in a implentation flexibility loss.
15
+
It is harder to use higher-order function with the class keyword than it is with regular functions. Regular functions can be mixed, composed, curried etc. Overall it results in a implantation flexibility loss.
16
16
17
17
### class and implicit code
18
18
@@ -39,7 +39,7 @@ I don't consider using the old syntax (e.g with .prototype) a good alternative a
39
39
40
40
First, there needs to be a true viable alternative.
41
41
42
-
### contructor/creator
42
+
### constructor/creator
43
43
44
44
With the class keyword an empty object is implicitly created and the `this` becomes it, and `this` is implicitly returned. It turns out, that any function can create an object and return it too. A creator function can also return a `Map` or a `Set` etc.
45
45
@@ -91,7 +91,7 @@ const createCar = ({ id }) => {
91
91
92
92
### inheritance (subtype-of)
93
93
94
-
Call the parent creator then, add, change and remove properties. Do not remove properties to respect the subsitution principle.
94
+
Call the parent creator then, add, change and remove properties. Do not remove properties to respect the substitution principle.
0 commit comments