#typescript — #javascript with superpowers — Part II
▻https://hackernoon.com/typescript-javascript-with-superpowers-part-ii-69a6bd2c6842?source=rss--
Welcome back to Part II! For a more articulated experience — read Part I first.TypeScript — JavaScript with superpowersEnums (enumerations) allow you to group values together with friendlier names. Imagine you had a list of names.Here’s how you would structure the enum:You can grab the values from the enum like so:But wait. It returns the integer which represents the index of the value. Like arrays, enums begin indexing their members starting at 0.How do we get the value "Indrek" instead of 0 ?Notice how the values are presented as a string.Another great example would be using enums to store the application states.In case you’re interested in learning more about enums— I found a great answer going in the nitty gritty of enum.Let’s say we fetched some data from an API. We always expect the (...)