Improving Your JavaScript with Enums

preview_player
Показать описание
This video explains what Enums are, why they are important, how to replicate them in JavaScript, and how you could use them.

Video about Property Descriptors:
Video about Callback Functions:
Video about Iterable vs Enumerable:

0:00 Approaches to building Enums
5:50 Practical uses for Enums
Рекомендации по теме
Комментарии
Автор

Thanks, nice approach. I always kind of miss real enums in JS and PHP, they're really useful!

KoenOnbekend
Автор

I never even thought to use the Object.freeze() method for this. Great idea! 💡

kieranbarker
Автор

I was implementing using the 2nd option but object.freeze is better, 🙏

pinakim
Автор

Or just use enums in typescript lol. Gr8 video

igorr
Автор

TypeScript page reminds devs not to use enums where a simple literal with 'as const' is enough.

aram