Angular · Junior · Question 38 of 75

What is computed() used for?

firstName = signal("Ann");
lastName = signal("Lee");
fullName = computed(() => `${this.firstName()} ${this.lastName()}`);

Explanation

computed is lazy and memoized: it recalculates only when a dependency changes and someone reads it. You can't set a computed signal.

Further reading

Problem with a question

Angular · Junior · question 38

Test yourself

Take the Angular · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz