Functional Programming - Apply Functional Programming to Convert Strings to URL Slugs

Tell us what’s happening:
I wrote that this is working I have checked it in VS code and the output is correct but the code dosn’t pass because it says that Winter is comming is not returning winter-is-comming but it does

Your code so far

// Only change code below this line
function urlSlug(title) {

  return title.toLowerCase().split(" ").join("-");
}
// Only change code above this line
urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 OPR/98.0.0.0

Challenge: Functional Programming - Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

Try using a console.log to see what is returned when the string " Winter Is Coming" is passed to the function. Note that there is a space before Winter and two spaces between Is and Coming.

Yes but they got replaced with the -

Which means that your code returns -winter-is--coming instead of winter-is-coming.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.