Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum Something {
- PENNY("PENNY"), NICKLE("NICKLE");
- private String value;
- private Something (String value) {
- this.value = value;
- }
- };
- export enum ControlType {
- INPUT,
- SELECT,
- DATEPICKER
- }
- console.log(ControlType.INPUT); // returns 0
- console.log(ControlType[ControlType.INPUT]); // returns INPUT
- export enum ControlType {
- INPUT = 3,
- SELECT = 6,
- DATEPICKER = "abc".length // computed member
- }
- console.log(ControlType.INPUT); // returns 3
- export enum ControlType {
- INPUT = <any>'input',
- SELECT = <any>'select',
- DATEPICKER = <any>'date-picker'
- }
- console.log(ControlType.INPUT); // returns 'input'
- (ControlType.INPUT === myVar) {..}
- enum Direction { Up, Down, Left, Right }
- console.info(Direction[Direction.Up]); // "Up"
- const directionText = new Map([
- [Direction.Up, 'UP'],
- // ...
- ]);
Add Comment
Please, Sign In to add comment