Enum

    0

    3

    Giovanny Gongora

    Codiga's TypeScript Recipes

    By default, any enum will begin numbering their members starting at 0.

    enum Color {
      Gray, // 0
      Red, // 1
      Green = 100, // 100
      Blue, // 101
      Yellow = 2 // 2
    }
    const myColor: Color = Color.Green
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.