Anomaly in output from enumerators in typescript

Viewed 59

Can anyone explain the output i am getting from the below code?

enum days { sun = 1, mon = 0, tues };

console.log(days[1]); // returns tues // expected output -- mon
console.log(days[0]); // returns mon // expected output -- sun

Also, please explain how can i get sun printed in this case? This scenario is baffling me. Request you guys to provide valid explanations only after you have executed the code and observed the output.

2 Answers
Related