I understand this question has been asked for a billion times, but i still can't understand how the enums work.
For example i got simple enum
export enum Type {
Null,
First,
Second,
Third
}
Now the question, what is difference betweeen those code
if (myObject.type === 2) doStuff();
And this one:
if (myObject.type === Type.Second) doStuff();
Im getting myObject
from backend and i need to detect this object type to run some function, why should i do this with enums type
Maybe i'am wrong, but my examples do exactly the same things
Can you please explain me why should i use enums type in my example