Skip to content

Commit 7f0df7c

Browse files
authored
Added singular plural to differentiate between value and array of values
1 parent c234734 commit 7f0df7c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,19 @@ function fetchPosts() {
315315
this.setState({ posts: nextPosts })
316316
}
317317
```
318+
319+
## Singular/Plurals
320+
321+
Like a prefix, variable names can be made singular or plural depending on whether they hold a single value or multiple values.
322+
323+
324+
```js
325+
/* Bad */
326+
const friends = 'Bob';
327+
const friend = ['Bob', 'Tony', 'Tanya'];
328+
329+
/* Good */
330+
const friend = 'Bob';
331+
const friends = ['Bob', 'Tony', 'Tanya'];
332+
```
333+

0 commit comments

Comments
 (0)