Bird
0
0

Given the code:

medium📝 state output Q13 of 15
Angular - State Management
Given the code:
const count = signal(0);
count.set(5);
console.log(count());

What will be printed in the console?
A5
B0
Cundefined
DError: count is not a function
Step-by-Step Solution
Solution:
  1. Step 1: Understand signal creation and update

    The signal count starts at 0, then set(5) changes its value to 5.
  2. Step 2: Reading the signal value

    Calling count() returns the current value, which is 5 after the update.
  3. Final Answer:

    5 -> Option A
  4. Quick Check:

    count.set(5) updates value, count() reads it [OK]
Quick Trick: Use count() to read updated signal value [OK]
Common Mistakes:
  • Thinking count() returns initial value
  • Confusing set() with reading value
  • Assuming count is not callable

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes