From 96b71a8c14d8b2ca522ef1e2bbb84bd360d79cf1 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Fri, 30 Jun 2017 12:07:17 +0200 Subject: [PATCH] Update README.md --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7976f4f..0362f1e 100644 --- a/README.md +++ b/README.md @@ -110,14 +110,17 @@ link.addEventListener('click', handleLinkClick); ``` ## Prefixes +Prefixes enhance variables/methods, and serve as a quick indicators of additional meaning behind them. + #### `is` -Describes certain characteristic of the context. +Describes certain characteristic or state of the context. ```js const color = 'blue'; -const isBlue = (color === 'blue'); +const isBlue = (color === 'blue'); // characteristic +const isRemoved = false; // state -if (isBlue) { - console.log('The color is blue!'); +if (isBlue && !isRemoved) { + console.log('The color is blue and it is present!'); } ``` @@ -130,6 +133,17 @@ function PostsList() { } ``` +#### `has` +Describes whether current context possesses a certain value or state. +```js +/* Bad */ +const isProductsExist = (productsCount > 0); +const areProductsPresent = (productsCount > 0); + +/* Good */ +const hasProducts = (productsCount > 0); +``` + #### `should` Reflects conditional statement (returns `Boolean` value). ```js