Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```ts
- enum Direction {
- Up = 1,
- Down,
- Left,
- Right
- }
- ```
- ```js
- // 编译后
- var Direction;
- (function(Direction) {
- Direction[(Direction['Up'] = 1)] = 'Up';
- Direction[(Direction['Down'] = 2)] = 'Down';
- Direction[(Direction['Left'] = 3)] = 'Left';
- Direction[(Direction['Right'] = 4)] = 'Right';
- })(Direction || (Direction = {}));
- ```
- ```js
- // 结果
- { '1': 'Up',
- '2': 'Down',
- '3': 'Left',
- '4': 'Right',
- Up: 1,
- Down: 2,
- Left: 3,
- Right: 4 }
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement