I have the following TypeScript enum:
enum Country {
BR = "Brazil",
NO = "Norway"
}
Then imagine I have a method that takes a Country
as an argument, like so:
someFunc = (country: Country): void => {
console.log(country) //Will print "Brazil" if country = Country.BR
console.log(Country[country]) //Same as above
console.log(???) //I want to print "BR" if country = Country.BR
}
How do I solve the third console.log
statement?
How do I get a hold of the enum key?
Regards