Tell us what’s happening:
Describe your issue in detail here.
So ive been testing this code and it seems to work but FreeCode Camp marks it as wrong, can anyone explain why?
**Your code so far**
// Only change code below this line
function urlSlug(title) {
title1 = title.slice(0, title.length).split(/\W/)
title2 = []
for (var x of title1){
if (x.length === 0) {
continue
} else{
title2.push(x)
}
}
return title2.join('-')
}
// Only change code above this line
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
Link to the challenge: