I noticed this just now when trying to iterate over an enum.
Say you have:
enum Gender {
Male = 1,
Female = 2
}
and you do:
for (let gender in Gender) {
console.log(gender)
}
This will run 4 (?) times. First printing string (!) representations of 1 and 2, then printing the strings Male and Female.
I can only suppose this is intended. My question is why this is the case? What's the reasoning behind this (in my opinion) weird implementation?