Enums

Enums allow you to specify named values that correspond to numeric or string values. If you don't manually set the associated corresponding value, the named values in the enum are numbered, starting at 0 by default. Enums are extremely useful, and are commonly used to represent a set of predefined options or lookup values.

In TypeScript, you define enums by using the enum keyword as follows:

enum Color {Red, Green, Blue}
const c: Color = Color.Red;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.19.185