I am failing to pass the test:
So my code bellow seemed to work until this test:
urlSlug(" Winter Is Coming")
should return the stringwinter-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: