Added getter/setter info

I tried to search for getter/setter in the readme but nothing was found. Added some info to make a clear statement about them
This commit is contained in:
Felix Sanz
2016-02-23 01:25:02 +01:00
parent db8b07f51a
commit 714f71d1d2

View File

@@ -1033,7 +1033,7 @@ Other Style Guides
- [11.1](#11.1) <a name='11.1'></a> Don't use iterators. Prefer JavaScript's higher-order functions like `map()` and `reduce()` instead of loops like `for-of`. eslint: [`no-iterator`](http://eslint.org/docs/rules/no-iterator.html)
> Why? This enforces our immutable rule. Dealing with pure functions that return values is easier to reason about than side-effects.
> Why? This enforces our immutable rule. Dealing with pure functions that return values is easier to reason about than side effects.
```javascript
const numbers = [1, 2, 3, 4, 5];
@@ -2217,7 +2217,7 @@ Other Style Guides
## Accessors
- [23.1](#23.1) <a name='23.1'></a> Accessor functions for properties are not required.
- [23.2](#23.2) <a name='23.2'></a> If you do make accessor functions use getVal() and setVal('hello').
- [23.2](#23.2) <a name='23.2'></a> Do not use JavaScript getters/setters as they cause unexpected side effects and are harder to test, maintain, and reason about. Instead, if you do make accessor functions, use getVal() and setVal('hello').
```javascript
// bad