Build a small greeting helper from reusable string functions.
Build a small greeting helper. The main function, createGreeting, should take a person's first name, last name, and time of day, then return one greeting string.
Write these functions:
formatName(firstName, lastName) should return the first and last name as one string.
getGreeting(timeOfDay) should return "Good morning", "Good afternoon", or "Good evening".
createGreeting(firstName, lastName, timeOfDay) should use the other two functions and return the final greeting.
Sample checks:
Expected output:
Your functions should return strings. Use console.log only to test your answer.
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.