← Back to challenges

Hello; Hello World; World

JavaScriptHardmathconditionsstrings

Instructions

Write a function that takes an integer and:

  • If the number is a multiple of 3, return "Hello".
  • If the number is a multiple of 5, return "World".
  • If the number is a multiple of both 3 and 5, return "Hello World".

Examples

helloWorld(3) ➞ "Hello"

helloWorld(5) ➞ "World"

helloWorld(15) ➞ "Hello World"
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: WordCharWord