From 535cb799a9f94d8898071c0fd161810b18c7fa08 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 2 Nov 2016 16:02:35 +0100 Subject: [PATCH] [guide] Mention both num++ and num ++ --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fee83928..5bc9c49f 100644 --- a/README.md +++ b/README.md @@ -1547,15 +1547,15 @@ Other Style Guides - [13.6](#variables--unary-increment-decrement) Avoid using unary increments and decrements (++, --). eslint [`no-plusplus`](http://eslint.org/docs/rules/no-plusplus) - > Why? Per the eslint documentation, unary increment and decrement statements are subject to automatic semicolon insertion and can cause silent errors with incrementing or decrementing values within an application. It is also more expressive to mutate your values with statements like `num += 1` instead of `num ++`. Disallowing unary increment and decrement statements also prevents you from pre-incrementing/pre-decrementing values unintentionally which can also cause unexpected behavior in your programs. + > Why? Per the eslint documentation, unary increment and decrement statements are subject to automatic semicolon insertion and can cause silent errors with incrementing or decrementing values within an application. It is also more expressive to mutate your values with statements like `num += 1` instead of `num++` or `num ++`. Disallowing unary increment and decrement statements also prevents you from pre-incrementing/pre-decrementing values unintentionally which can also cause unexpected behavior in your programs. ```javascript // bad let array = [1, 2, 3]; let num = 1; - num ++; - -- num; + num++; + --num; let sum = 0; let truthyCount = 0;