Bird
0
0

Given the enum declaration:

medium📝 component behavior Q13 of 15
Angular - TypeScript in Angular
Given the enum declaration:
enum Status { Active = 1, Inactive = 0 }

What will be the output of console.log(Status.Active)?
A1
BActive
C0
Dundefined
Step-by-Step Solution
Solution:
  1. Step 1: Understand enum value assignment

    Status.Active is explicitly assigned the value 1 in the enum.
  2. Step 2: Check what console.log prints

    Logging Status.Active prints its numeric value, which is 1.
  3. Final Answer:

    1 -> Option A
  4. Quick Check:

    Enum value = number assigned [OK]
Quick Trick: Enum member prints its assigned value [OK]
Common Mistakes:
  • Expecting the name 'Active' to print instead of value
  • Confusing 0 and 1 values
  • Assuming undefined if not string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes