Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 721 Bytes

what_is_an_enum.md

File metadata and controls

21 lines (15 loc) · 721 Bytes

What is an enum?

An enum (short for 'enumeration') is a feature in programming languages like TypeScript, which allows you to define a set of named constants. Enums help in making code more readable and maintainable by giving meaningful names to values.

Example in TypeScript:

enum Color {
  Red = 'RED',
  Green = 'GREEN',
  Blue = 'BLUE'
}
let color: Color = Color.Red;
console.log(color); // 'RED'

Tags: intermediate, JavaScript, TypeScript

URL: https://www.tiktok.com/@jsmentoring/photo/7465480690658725152