Failing Convert Strings to URL Slugs

I am failing to pass the test:
So my code bellow seemed to work until this test:

urlSlug(" Winter Is Coming") should return the string winter-is-coming .

and my browser dev tool console seems to output the result that the test asks for: winter-is-coming
This exercise hint section contains only solutions and I would like to solve it before checking them out.
So guidance would be appreciated…

Your code so far

// Only change code below this line
function urlSlug(title) {
return title.trim().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/100.0.4896.127 Safari/537.36

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

When I put this at the bottom of your code:

console.log(urlSlug(" Winter Is  Coming"))

I get this in the output:


That does not match the expected output.

Again thank you for your reply kevinSmith,
I am looking at the argument I pasted and got no clue where from did I copy it :smiley: .
I have edited my split() function argument to fix the problem you have highlighted.

1 Like

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