Answers for "typescript enum convert string to number"

0

typescript string to enum

enum Day {
    BeforeNoon = "AM",
    AfterNoon = "PM"
} 

var beforeNoon : string = "AM";
var enumValue : Day = (<any>Day)[beforeNoon];
Posted by: Guest on March-18-2021
0

enum to number typescript

enum UserResponse {
  No = 0,
  Yes = 1,
}
console.log(UserResponse.Yes) //logs : 1
Posted by: Guest on January-08-2021

Code answers related to "typescript enum convert string to number"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language