enum UserResponse {
No = 0,
Yes = 1,
}
function respond(recipient: string, message: UserResponse): void {
console.log(recipient, message); // "Princess Caroline", 1
}
respond("Princess Caroline", UserResponse.Yes);
An enumeration is a set of symbolic names (members) bound to unique, constant values. Within an enumeration, the members can be compared by identity, and the enumeration itself can be iterated over.