enum with If in typescript code example
Example 1: enum in ts
enum Direction {
Up,
Down,
Left,
Right,
}
Example 2: enum to number typescript
enum UserResponse {
No = 0,
Yes = 1,
}
console.log(UserResponse.Yes) //logs : 1
enum Direction {
Up,
Down,
Left,
Right,
}
enum UserResponse {
No = 0,
Yes = 1,
}
console.log(UserResponse.Yes) //logs : 1