Bird
0
0

Which of the following is the correct syntax to create a signal holding a number starting at 10?

easy📝 Syntax Q3 of 15
Angular - Signals
Which of the following is the correct syntax to create a signal holding a number starting at 10?
Aconst count = signal(10);
Bconst count = new signal(10);
Cconst count = signal.set(10);
Dconst count = signal.create(10);
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct signal creation syntax

    The signal() function is called directly with the initial value.
  2. Step 2: Verify syntax correctness

    Using const count = signal(10); correctly creates a signal with initial value 10.
  3. Final Answer:

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

    Signal creation syntax = signal(initialValue) [OK]
Quick Trick: Create signals by calling signal() with initial value [OK]
Common Mistakes:
  • Using new keyword with signal
  • Calling non-existent methods like set or create on signal
  • Confusing signal with class instantiation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes