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] === ""){
urlTitle.shift();
}
let urlString = urlTitle.join("-");
console.log(urlString);
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: