Angular · Junior · Question 38 of 75
What is computed() used for?
firstName = signal("Ann");
lastName = signal("Lee");
fullName = computed(() => `${this.firstName()} ${this.lastName()}`);- ✓Correct answer: A read-only signal derived from other signals, recalculated only when they change
- 2A signal that is computed on the server
- 3A function that runs a side effect on every change
Explanation
computed is lazy and memoized: it recalculates only when a dependency changes and someone reads it. You can't set a computed signal.