Bird
0
0

What is wrong with this computed signal definition?

medium📝 Debug Q7 of 15
Angular - Signals
What is wrong with this computed signal definition?
const price = signal(10);
const tax = signal(2);
const total = computed(() => price + tax());
Aprice signal is not called as a function inside computed
Btax signal should not be called inside computed
Ccomputed cannot use arrow functions
DSignals cannot be used inside computed
Step-by-Step Solution
Solution:
  1. Step 1: Review signal usage inside computed

    Signals must be called as functions to get their current value, e.g., price() and tax().
  2. Step 2: Identify incorrect usage

    price is used without parentheses, so it refers to the signal object, not its value.
  3. Final Answer:

    price signal is not called as a function inside computed -> Option A
  4. Quick Check:

    Call all signals with () inside computed [OK]
Quick Trick: Call all signals with () inside computed [OK]
Common Mistakes:
  • Forgetting parentheses on signals
  • Thinking signals cannot be used in computed
  • Believing arrow functions are disallowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes