Format nested user data into a smaller profile summary.
Format a nested user object into values that are easier to show in an interface or return from an API. The final summary should collect the smaller pieces.
Write these functions:
getDisplayName(user) should return the first and last name as one string.
getLocation(user) should return "City, Country".
getContactSummary(user) should return an object with email and phone.
isAccountActive(user) should return true when account.status is "active".
createProfileSummary(user) should return displayName, location, contact, active, and plan.
Sample checks:
Expected output:
Keep phone as null when the user has no phone number.
Join the Community
roadmap.sh is the most starred project on GitHub and is visited by hundreds of thousands of developers every month.
Roadmaps Best Practices Guides Videos FAQs YouTube
roadmap.sh by @kamrify @kamrify
Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.
Login or Signup
You must be logged in to perform this action.