Bird
0
0

Which of the following is a valid enum declaration in Angular?

easy📝 Conceptual Q2 of 15
Angular - TypeScript in Angular
Which of the following is a valid enum declaration in Angular?
Aenum Color { Red, Green, Blue }
Benum Color = { Red, Green, Blue }
Cenum Color: [Red, Green, Blue]
Denum Color -> { Red, Green, Blue }
Step-by-Step Solution
Solution:
  1. Step 1: Recall enum syntax

    Enums use the syntax: enum Name { Value1, Value2, ... }
  2. Step 2: Identify correct syntax

    Only enum Color { Red, Green, Blue } matches this syntax exactly.
  3. Final Answer:

    enum Color { Red, Green, Blue } -> Option A
  4. Quick Check:

    Enum syntax = enum Name { ... } [OK]
Quick Trick: Use curly braces without equals or arrows for enums [OK]
Common Mistakes:
  • Using '=' instead of braces
  • Using ':' or '->' incorrectly
  • Missing enum keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes