11. What is the default value of an ENUM?

If there are no values assigned to Enum, it's values are enumerated from 0.

enum NotAssigned { VAL1, VAL2 } enum Assigned { VAL1 = "value1", VAL2 = "value2" } console.info(NotAssigned.VAL1, NotAssigned.VAL2); // 0, 1 console.info(Assigned.VAL1, Assigned.VAL2); // value1, value2 console.info(NotAssigned[0], NotAssigned[1]); // VAL1, VAL2 console.info(NotAssigned[NotAssigned.VAL1], NotAssigned[NotAssigned.VAL2]); // VAL1, VAL2 console.info(Assigned[0]); // Property '0' does not exist on type 'typeof Assigned'
Struggling to find common date to meet with your friends? Try our new tool commondate.xyz
devFlipCards 2025

Do you accept cookies?

Cookies are small amounts of data saved locally on you device, which helps our website - it saves your settings like theme or language. It helps in adjusting ads and in traffic analysis. By using this site, you consent cookies usage.

Struggling to find common date to meet with your friends? Try our new tool
commondate.xyz