Greeting Builder
Build a small greeting helper from reusable string functions.
5 upvotes
10 upvotes
Greeting Builder
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.
Solution
Solution:
