A project manager asks how TypeScript's `enum` differs from a plain object of constants, and when each should be used. What is the key distinction to communicate?
-
A
Enums are always faster at runtime than plain objects
-
B
Enums generate runtime JavaScript code and support reverse mapping, while const objects with `as const` are lighter and preferred for tree-shaking
-
C
Plain objects cannot be used as TypeScript types
-
D
Enums automatically prevent duplicate values at compile time