I have an enum defined this way:
export enum GoalProgressMeasurements {
Percentage = 1,
Numeric_Target = 2,
Completed_Tasks = 3,
Average_Mile
If you are using ES6
It will give you value array of the given enum.
enum Colors {
WHITE = 0,
BLACK = 1,
BLUE = 3
}
const colorValueArray = Object.values(Colors); //[ 'WHITE', 'BLACK', 'BLUE', 0, 1, 3 ]
You will get colorValueArray
like this [ 'WHITE', 'BLACK', 'BLUE', 0, 1, 3 ]
. All the keys will be in first half of the array and all the values in second half.