Answers for "how to get both key and value of enum in typescript"

0

how to get both key and value of enum in typescript

var enumNames=[];
for (var log in LogEntry) {
    if (isNaN(Number(log))) {
       enumNames.push(log);
   }    
}
console.log(enumNames);

//Output
//["ERROR", "WARN", "INFO", "DEBUG"]
Posted by: Guest on April-22-2021
0

how to get both key and value of enum in typescript

var enumValues=[];
for (var log in LogEntry) {
    if (!isNaN(Number(log))) {
       enumValues.push(log);
   }    
}
console.log(enumValues);

//Output
//["0", "1", "2", "3"]
Posted by: Guest on April-22-2021

Code answers related to "how to get both key and value of enum in typescript"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language