Why is my program failing for " Winter Is Coming"?

Tell us what’s happening:
Describe your issue in detail here.

Your code so far


// Only change code below this line
function urlSlug(title) {
const newArray = title.split(/\W/);
//console.log(newArray);
const modified =  newArray.join("-");
//console.log(modified);
return modified.toLowerCase();
}
// Only change code above this line
//urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone");
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/100.0.4896.127 Safari/537.36

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

If you put

console.log(urlSlug(" Winter Is  Coming"))

you will see what you’re returning. Compare that to what is expected.

1 Like

Thanks @kevinSmith . I found the issue after using the console.log. It worked out.

1 Like