Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfbd885

Browse files
authored
Fix typos in enum tutorial
1 parent d768900 commit cfbd885

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tutorials/fundamentals/enum.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Direction {
6565
this.name = name;
6666
}
6767
toString() {
68-
return `Color.${this.name}`;
68+
return `Direction.${this.name}`;
6969
}
7070
}
7171
```
@@ -78,4 +78,4 @@ Here's how you can work with the `Direction` class:
7878

7979
This approach is interesting, and there's even a [enumify npm package](https://www.npmjs.com/package/enumify) that implements this basic approach along with additional syntactic sugar. This approach also has the neat benefit that `Direction.Downe.name` throws an error, which means you don't accidentally check `undefined === undefined` if you typo an enum property.
8080

81-
However, we generally recommend using `Object.freeze()` on a [POJO](/tutorials/fundamentals/pojo) to represent an enum. Enumify does offer advatanges and some neat syntactic sugar, but we think a POJO gets you most of the advantages with much less overhead.
81+
However, we generally recommend using `Object.freeze()` on a [POJO](/tutorials/fundamentals/pojo) to represent an enum. Enumify does offer advantages and some neat syntactic sugar, but we think a POJO gets you most of the advantages with much less overhead.

0 commit comments

Comments
 (0)