Recently diving into the world of TypeScript, I've been experimenting with different types in this language.
One interesting data type I played with is enums. Here's an example of code I used:
enum colors {red=1,green=0,blue,white};
console.log(colors[1]);
To my surprise, the console output was 'blue' instead of 'red'.
This got me thinking - what exactly happens when assigning values to enums in descending order? Can someone shed some light on this behavior?