Essential JavaScript

Phrase Builder Kata

You are on a team building the first general-purpose household robot.

Your job is to teach the robot how to talk. You are starting with simple phrases.

You will be given four words, with each word being a different part of speech:

  • verb (like "walk")
  • article (like "the")
  • adjective (like "energetic")
  • noun (like "puppies")

For the above example, the output should be "walk the energetic puppies".

The robot needs to see spaces between each word in order to recognize and pronounce them correctly. Write a function that returns the input words as a single string containing the phrase that the robot must speak.

Code Editor