From 723e50d61ec1300acc1c2cd3451fa9e8003eb899 Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Sun, 30 Oct 2016 22:33:14 +0000 Subject: [PATCH] Value is number, not string --- docs/enums.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/enums.md b/docs/enums.md index d9d26577b..95fe7eb38 100644 --- a/docs/enums.md +++ b/docs/enums.md @@ -59,7 +59,7 @@ var Tristate; })(Tristate || (Tristate = {})); ``` -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: +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: ```ts enum Tristate {