Contact Email: Guard Optional
Optional properties often represent data that may be missing. Before using an optional value, check for undefined. If present, you can safely call methods on it; otherwise provide a fallback.
Your Task
- Complete the function formatContact(c: { name: string; email?: string }): string.
- If email exists, return c.name + ' <' + c.email.toLowerCase() + '>'.
- Otherwise, return c.name + ' (no-email)'.
Examples