![]() |
Enum in TypeScript is a shorthand used for the enumerations. Enum is a way of defining multiple related named constants at the same place in the form of a collection which can be later accessed and assigned to other variables in the code. By default, the enums are assigned with number type values starting from 0. You can also assign them with the string values using the assignment operator(=). It helps to enhance the code readability and maintainability by defining meaningful identifiers for the magic strings and the numbers. Syntax:enum enumName { Exmaple:
Output: 0 |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |