Reading the 'enum' in typescript, I see this code compiled to javascript.
var Season = [];
Season[Season["Spring"] = 0] = "Spring";
Season[Season["Summer"] = 1] = "Summer";
Season[Season["Fall"] = 2] = "Fall";
Season[Season["Winter"] = 3] = "Winter";
console.log(Season.Spring); // 0
console.log(Season[0]); // Spring
and, if I change Season to {} empty objext at first line, this also works and it makes sense. I don't know what's happening hear. What is this?
Edit: Yes. This is not what compiler generate. Compiler uses empty object. But if I changed it to empty array. It still works. My question was why array also works good. At first my question included both version, but someone edited question and delete object-use version.