TypeScript Tutorial 7: enum

preview_player
Показать описание
Learn what is enum in TypeScript and how to make use of it in your projects.

Рекомендации по теме
Комментарии
Автор

I used enums in c#.. Main use is not to keep values.. I use enums there where I have properties with a defined number of values.. For example property color.. If is string can have value 'dads', but if u create enum Colors witch contains colors and declare ur property of type Color (ur enum) then u have a limited number of choices

mvdlele
Автор

In this tutorial you told that enum cannot accept string and produce error at compile time but at my end it doesn't produce any error even it compiled smoothly. Please have a look of the below code.
enum myConstants{
a = "pqefg",
pi = 3.14,
e = 2.73
}
console.log(myConstants.a);

Let me know if i am doing anything wrong.

Thanks,

groot
Автор

I have been noticing for a long time that you always forget the formula of area of a circle and at the end you decide to go for the circumference instead of area :P :D

prasadankit
Автор

What is going on guys my name is Bucky :D

VikasRHanagodimath
welcome to shbcf.ru