Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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"]
Source by www.angularjswiki.com #
 
PREVIOUS NEXT
Tagged: #key #enum #typescript
ADD COMMENT
Topic
Name
6+6 =