← Back to challenges

Say "Hello" Say "Bye"

JavaScriptHardstringscontrol_flowconditions

Instructions

Write a function that takes a string name and a number num (either 0 or 1) and return "Hello" + name if num is 1, otherwise return "Bye" + name.

Examples

sayHelloBye("alon", 1) ➞ "Hello Alon"

sayHelloBye("Tomi", 0) ➞ "Bye Tomi"

sayHelloBye("jose", 0) ➞ "Bye Jose"

Notes

The name you return must be capitalized.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Currying Functions