← All Exercises

Enum Type Usage

basictypescript~10min

Background

Enums provide a way to define named constant sets, improving code readability over magic numbers or strings.

Problem

Create a numeric enum for OrderStatus (Pending, Processing, Shipped, Delivered) and a function that returns true if the status is Delivered.

Input

An OrderStatus enum value.

Output

A boolean indicating whether the order status is Delivered.

Sample tests

Sample 1

Input: OrderStatus.Delivered
Expected: true

Your solution

Learning objective

Understand enum definition and usage for representing fixed sets of values.