Skip to content

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"]
See also  How to reverse the order of columns in matrix in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.