Tell us what’s happening:
It is saying that this code is not correct. However, when I console log it it seems to be giving the output that it is after. Can someone have a look and let me know what I am doing wrong. I have done the split so that it matches 1+ white spaces
Your code so far
// Only change code below this line
function urlSlug(title) {
return title.split(/\W+/)
.map(a => a.toLowerCase())
.join("-")
}
// Only change code above this line
console.log(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/85.0.4183.102 Safari/537.36
.
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
Link to the challenge: