Tell us what’s happening:
I got the same output using map() method, but the validator doesn’t accept it. Why is this happening?
Your code so far
// The global variable
var globalTitle = "Winter Is Coming";
// Only change code below this line
function urlSlug(title) {
return title.split(/\W/).map(word => word.toLowerCase()).join("-")
}
// Only change code above this line
console.log(urlSlug(globalTitle));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
.
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
Link to the challenge: