Skip to content

Commit 0e3eeb9

Browse files
committed
spelling and add notes
1 parent f6a284a commit 0e3eeb9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

js/red-javascript-style-guide/why-disallow-class.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
### A certain amount of additional vocabulary
66

7-
`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.
7+
`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.
88

99
### Not transferrable in between realms
1010

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.
1212

13-
### Compatibilty with higher-order functions
13+
### Compatibility with higher-order functions
1414

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.
1616

1717
### class and implicit code
1818

@@ -39,7 +39,7 @@ I don't consider using the old syntax (e.g with .prototype) a good alternative a
3939

4040
First, there needs to be a true viable alternative.
4141

42-
### contructor/creator
42+
### constructor/creator
4343

4444
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.
4545

@@ -91,7 +91,7 @@ const createCar = ({ id }) => {
9191

9292
### inheritance (subtype-of)
9393

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.
9595

9696

9797
```js

0 commit comments

Comments
 (0)