Remove quotes around comma operator

This commit is contained in:
Brent Guffens 2018-01-17 12:43:14 +01:00 committed by GitHub
parent abef5c4379
commit 6109448768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -253,14 +253,14 @@ So, there are special operators for that:
```js run no-beautify ```js run no-beautify
let counter = 2; let counter = 2;
counter++; // works same as counter = counter + 1, but shorter counter++; // works the same as counter = counter + 1, but is shorter
alert( counter ); // 3 alert( counter ); // 3
``` ```
- **Decrement** `--` decreases a variable by 1: - **Decrement** `--` decreases a variable by 1:
```js run no-beautify ```js run no-beautify
let counter = 2; let counter = 2;
counter--; // works same as counter = counter - 1, but shorter counter--; // works the same as counter = counter - 1, but is shorter
alert( counter ); // 1 alert( counter ); // 1
``` ```
@ -408,9 +408,9 @@ alert( n ); // 16 (right part evaluated first, same as n *= 8)
## Comma ## Comma
The comma operator `','` is one of most rare and unusual operators. Sometimes it's used to write shorter code, so we need to know it in order to understand what's going on. The comma operator `,` is one of most rare and unusual operators. Sometimes it's used to write shorter code, so we need to know it in order to understand what's going on.
The comma operator allows us to evaluate several expressions, dividing them with a comma `','`. Each of them is evaluated, but the result of only the last one is returned. The comma operator allows us to evaluate several expressions, dividing them with a comma `,`. Each of them is evaluated, but the result of only the last one is returned.
For example: For example: