From 7f0df7c9e6cd3e755e2028a1b333e6faa7edf192 Mon Sep 17 00:00:00 2001 From: sagarjs Date: Thu, 31 Oct 2019 11:01:19 +0530 Subject: [PATCH] Added singular plural to differentiate between value and array of values --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 7929aa0..4fcbfed 100644 --- a/README.md +++ b/README.md @@ -315,3 +315,19 @@ function fetchPosts() { this.setState({ posts: nextPosts }) } ``` + +## Singular/Plurals + +Like a prefix, variable names can be made singular or plural depending on whether they hold a single value or multiple values. + + +```js +/* Bad */ +const friends = 'Bob'; +const friend = ['Bob', 'Tony', 'Tanya']; + +/* Good */ +const friend = 'Bob'; +const friends = ['Bob', 'Tony', 'Tanya']; +``` +