Tell us what’s happening:
I’ve run my solution against the test but I can’t seem to figure out why my Regex usage doesn’t pass.
Describe your issue in detail here.
I’m supposed to use .split(/\s+/) instead of .split(/\W/) but when I use console log I’m getting the right response for the test that won’t pass:
urlSlug(" Winter Is Coming")
should return the string winter-is-coming
.
console log = “winter-is-coming”
Your code so far
// Only change code below this line
function urlSlug(title) {
return title.toLowerCase().trim().split(/\W/).join("-")
}
// Only change code above this line
urlSlug(" Winter Is Coming");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Challenge: Functional Programming - Apply Functional Programming to Convert Strings to URL Slugs
Link to the challenge: