-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnums.ts
More file actions
38 lines (30 loc) · 681 Bytes
/
Copy pathEnums.ts
File metadata and controls
38 lines (30 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Enums:An enum is a special "class" that represents a group of constants.string and numeric representations.
//Enum Numeric:
enum Months{
Jan,
Feb,
March,
April,
May,
}
let currentDirection = Months.Feb
console.log(currentDirection);
enum Direction{
Up = 2,
Down = 3,
Right,
Left
}
let currentDirection1 =Direction.Down
console.log(Direction);
console.log("Direction:",currentDirection1);
//Enum String:
enum DirectionString{
Up = 'Up',
Down = 'Down',
Right = 'Right',
Left = 'Left'
}
let currentDirection2 =DirectionString.Left
console.log(DirectionString);
console.log("DirectionString:",currentDirection2);