diff --git a/README.md b/README.md index c7f1c98d..6396a488 100644 --- a/README.md +++ b/README.md @@ -1521,24 +1521,28 @@ Other Style Guides let array = [1, 2, 3]; let num = 1; - let increment = num ++; - let decrement = -- num; + num ++; + -- num; + let sum = 0; + let truthyCount = 0; for(let i = 0; i < array.length; i++){ let value = array[i]; - ++value; + sum += value; + if (value) { + truthyCount++; + } } // good let array = [1, 2, 3]; let num = 1; - let increment = num += 1; - let decrement = num -= 1; + num += 1; + num -= 1; - array.forEach((value) => { - value += 1; - }); + const sum = array.reduce((a, b) => a + b, 0); + const truthyCount = array.filter(Boolean).length; ``` **[⬆ back to top](#table-of-contents)**