D
D
danilr2019-09-05 05:30:51
typescript
danilr, 2019-09-05 05:30:51

Enum entry without value?

One of the values ​​comes from the back, was made to match enum

enum EPhone  {
    INVALID = "INVALID",
    ALREADY_EXISTS = "ALREADY_EXISTS",
    SUCCESS = "SUCCESS"
}

I saw in someone else's code that someone is doing enum without values ​​and I want to understand what this means and what is the analogue of such a record?
enum EPhone  {
    INVALID,
    ALREADY_EXISTS,
    SUCCESS
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2019-09-05
@danilr

https://www.tutorialsteacher.com/typescript/typesc...

enum EPhone  {
    INVALID,
    ALREADY_EXISTS,
    SUCCESS
}

Analog
enum EPhone  {
    INVALID=0,
    ALREADY_EXISTS=1,
    SUCCESS=2
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question