Complete the code to access the enum member.
enum Color { Red, Green, Blue }
const favorite = Color.[1];The enum member Red is accessed using Color.Red.
Complete the code to get the numeric value of the enum member.
enum Direction { Up = 1, Down, Left, Right }
const dirValue = Direction.[1];The enum member Up has the numeric value 1, accessed by Direction.Up.
Fix the error in accessing the enum member.
enum Status { Active = 'ACTIVE', Inactive = 'INACTIVE' }
const currentStatus = Status.[1];Enum members are case-sensitive. The correct member is Inactive, not active or ACTIVE.
Fill both blanks to access the enum member and get its value.
enum Fruit { Apple = 5, Banana = 10 }
const fruitName = Fruit.[1];
const fruitValue = Fruit.[2];Fruit.Apple and Fruit.Banana access the enum members correctly.
Fill all three blanks to create an enum, access a member, and get its value.
enum Vehicle { [1] = 1, [2] = 2, [3] = 3 }
const myVehicle = Vehicle.Car;The enum members are Car, Bike, and Truck. They are assigned values 1, 2, and 3 respectively.
