Search
 
SCRIPT & CODE EXAMPLE
 

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"]
Comment

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"]
Comment

PREVIOUS NEXT
Code Example
Typescript :: adonis route group 
Typescript :: typescript checkbox object is possibly null 
Typescript :: knex could not determine data type of parameter $1 
Typescript :: terrform variable list type 
Typescript :: typescript get string value of enum 
Typescript :: Which Protect Presentation option protects a presentation from accidental changes: 
Typescript :: when we dont have to show data of child but change in child should be displayed in parent automatically 
Typescript :: array of linked lists in cpp 
Typescript :: How many arguments does a call to the Math.sqrt method have? 
Typescript :: nativescript date input validation 
Typescript :: @ViewChild takes 2 arguments error 
Typescript :: Correct this attempt to modify "product" or use "let" in its declaration. [+1 location] 
Typescript :: typescript react display array 
Typescript :: header elements on right 
Typescript :: how to create a record array from lists in python 
Typescript :: found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination. 
Typescript :: .for each typescript 
Typescript :: React Draft Wysiwyg typescript 
Typescript :: third party components in react native 
Typescript :: import tsa test 
Typescript :: not able to access string in template angular 8 
Typescript :: devide the subplot into subplots in mathplotlib 
Typescript :: graphql?query={__schema{types{name,fields{name}}}} 
Typescript :: About half of divorced parents try to avoid each other after the divorce, creating a different set of rules for children to follow in each parent’s household. This type of parental interaction is called 
Typescript :: spread types may only be created from object types firebase 
Typescript :: update object single property of firebase database object in angular 
Typescript :: post data 
Typescript :: convert java to typescript 
Typescript :: endurance testing 
Typescript :: whats a company letterhead 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =