You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
399 B

// 定义一组枚举命名常量:enum + 名字 {命名常量}
/* enum Direction {
// 枚举成员是有值得,默认从 0 开始自增的数值
Up,
Down,
Left,
Right
} */
enum Direction {
// 可以给枚举中的成员初始化值
Up = 2,
Down = 4,
Left = 8,
Right = 16
}
function changeDirection(direction: Direction) {}
changeDirection(Direction.Up)