Advertisement
Guest User

Untitled

a guest
May 25th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. ```ts
  2. enum Direction {
  3. Up = 1,
  4. Down,
  5. Left,
  6. Right
  7. }
  8. ```
  9.  
  10. ```js
  11. // 编译后
  12. var Direction;
  13. (function(Direction) {
  14. Direction[(Direction['Up'] = 1)] = 'Up';
  15. Direction[(Direction['Down'] = 2)] = 'Down';
  16. Direction[(Direction['Left'] = 3)] = 'Left';
  17. Direction[(Direction['Right'] = 4)] = 'Right';
  18. })(Direction || (Direction = {}));
  19. ```
  20.  
  21. ```js
  22. // 结果
  23. { '1': 'Up',
  24. '2': 'Down',
  25. '3': 'Left',
  26. '4': 'Right',
  27. Up: 1,
  28. Down: 2,
  29. Left: 3,
  30. Right: 4 }
  31. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement