Advertisement
728x90
No, javascript does not natively support enums. But there are different kinds of solutions to simulate them even though they may not provide exact equivalents. For example, you can use freeze or seal on object,
javascript
1var DaysEnum = Object.freeze({"monday":1, "tuesday":2, "wednesday":3, ...})Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 22
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
279of476