Skip to content

Commit d685e34

Browse files
authored
Merge pull request #183 from drewnoakes/patch-3
Value is number, not string
2 parents 4522b4a + 723e50d commit d685e34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/enums.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var Tristate;
5959
})(Tristate || (Tristate = {}));
6060
```
6161

62-
lets focus on the line `Tristate[Tristate["False"] = 0] = "False";`. Within it `Tristate["False"] = 0` should be self explanatory, i.e. sets `"False"` member of `Tristate` variable to be `"0"`. Note that in JavaScript the assignment operator returns the assigned value (in this case `0`). Therefore the next thing executed by the JavaScript runtime is `Tristate[0] = "False"`. This means that you can use the `Tristate` variable to convert a string version of the enum to a number or a number version of the enum to a string. This is demonstrated below:
62+
lets focus on the line `Tristate[Tristate["False"] = 0] = "False";`. Within it `Tristate["False"] = 0` should be self explanatory, i.e. sets `"False"` member of `Tristate` variable to be `0`. Note that in JavaScript the assignment operator returns the assigned value (in this case `0`). Therefore the next thing executed by the JavaScript runtime is `Tristate[0] = "False"`. This means that you can use the `Tristate` variable to convert a string version of the enum to a number or a number version of the enum to a string. This is demonstrated below:
6363

6464
```ts
6565
enum Tristate {

0 commit comments

Comments
 (0)