Complete the code to create a computed signal that derives the full name.
import { computed, signal } from '@angular/core'; const firstName = signal('John'); const lastName = signal('Doe'); const fullName = computed(() => [1]);
The computed signal must call the signals as functions to get their current values. So firstName() and lastName() are used, concatenated with a space.
Complete the code to create a computed signal that returns the length of the full name.
const fullNameLength = computed(() => [1]);
size instead of length.To get the length of the string value from a computed signal, you must call it as a function first, then access length.
Fix the error in the computed signal that tries to uppercase the full name.
const upperName = computed(() => [1]);
toUpperCase method.The computed signal must be called as a function to get the string value, then toUpperCase() is called as a method.
Fill both blanks to create a computed signal that returns the initials of the full name.
const initials = computed(() => [1] + [2]);
To get initials, take the first character of each name, call toUpperCase() on them, and concatenate.
Fill all three blanks to create a computed signal that returns the full name in 'Last, First' format.
const formattedName = computed(() => [1] + ', ' + [2]); // Also create a signal for greeting const greeting = signal('Hello'); const welcomeMessage = computed(() => [3] + ' ' + formattedName());
The formatted name uses last name, then first name separated by a comma. The welcome message combines the greeting signal with the formatted name.