I have an enum in typscript:
export enum MyEnum{
value1,
value2
}
And I have an array of enums:
let myEnumValues: Array<string | number> = [];
And I push an enum in:
myEnumValues.push(MyEnum.value2)
And if print the array:
console.log(myEnumValues);
// [ 1 ]
And if I loop through the array and print that:
for (var myEnumValue in myEnumValues) {
console.log(myEnumValue);
// 0
}
Why is it that I loop through an array that contains one item 1
and when I print it it's 0
?
I tried many variations and it is always different.
I can't figure it out.