Grasshopper - Personalized Message
# Problem Solving
Problem
Create a function that gives a personalized greeting. This function takes two parameters: name and owner.
Use conditionals to return the proper message:
Case | Return |
---|---|
name equals owner | âHello bossâ |
otherwise | âHello guestâ |
Solution
Create a function that generates a personalized greeting. This function takes two parameters: name and owner.
Use conditionals to return the proper message:
If name equals owner, return âHello bossâ. Otherwise, return âHello guestâ.
defaultFilename[object Promise]
In this solution, the greet function uses a ternary conditional operator to check whether name === owner. If they are equal, the function returns âHello bossâ; otherwise, it returns âHello guestâ.
JavaScript Playground
© aulianza