Convert Strings to URL Slugs - What am I missing?

Tell us what’s happening:
I’m trying to solve the challenge, it’s going pretty good this far. But my code won’t pass the third test : urlSlug(" Winter Is Coming") should return "winter-is-coming" .
Maybe I’m blind but I can’t see why I’m not passing the third test, any guidance would help me a lot! (what should I check, or rethink)

Thank you in advance!

Your code so far

// Only change code below this line
function urlSlug(title) {
let urlTitle = title.toLowerCase().split(" ");
if(urlTitle[0] === ""){

let urlString = urlTitle.join("-");
return urlString;
// Only change code above this line

urlSlug("Winter Is Coming");
urlSlug(" Winter Is Coming");
urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone");
urlSlug("Hold The Door");

Your browser information:

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

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

try this with some more spaces scattered in and see what your function produces

I see it now. Thank you for the clarification! Really appreciate it!

It inserts more dash characters per space character. But this doesn’t explain why it should not pass the test. Maybe my thinking is wrong, but it does actually what is required inside the test. :smile:

Anyways, thanks! :smiley: