export enum Animals {
Cow,
Pig
}
I have a function receiving an Enum:
export function printEnumName(Enum: any) {
console.log(someFancyFunctiontoPrintMyEnumName(Enum)); //It should print the enum's name "Animals"
}
I want to implement that fancy function to avoid sending it by parameter.
EDIT: I don't want to print the variables from Animals, like I mentioned on the commented line (also on the post's title) on the console log I want to print "Animals" the enum's name not the enum's variables on the function that is receiving Animals as a parameter. I tried to print using this approach but It didin't work:
export function printEnumName(Enum: any) {
for (let element in this.printEnumName) {
console.log(element); //It would be nice to print "Animals" literally animals
}
}