Bird
0
0

Which of the following is the correct way to create a signal with initial value 10?

easy📝 Syntax Q12 of 15
Angular - Signals
Which of the following is the correct way to create a signal with initial value 10?
Aconst count = signal(10);
Bconst count = Signal(10);
Cconst count = signal = 10;
Dconst count = signal.create(10);
Step-by-Step Solution
Solution:
  1. Step 1: Check the correct syntax for signal creation

    The correct syntax uses lowercase signal as a function with the initial value in parentheses.
  2. Step 2: Compare options

    const count = signal(10); matches the correct syntax: const count = signal(10);. Others use wrong casing or invalid syntax.
  3. Final Answer:

    const count = signal(10); -> Option A
  4. Quick Check:

    signal() function call with initial value [OK]
Quick Trick: Use lowercase signal() with parentheses for initial value [OK]
Common Mistakes:
  • Using uppercase Signal instead of signal
  • Assigning signal = 10 instead of calling signal(10)
  • Trying to call a create method on signal

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes