Help! Strings to URL Slugs... wrong output?

When I try the run test it says:
```urlSlug(" Winter Is Coming") should return “winter-is-coming”… but actually that’s the output I get (console and debugger). Even if I try adding more blank spaces between the words, the output is still `“winter-is-coming”. I don’t get why it says my code is wrong… can you help me, please!

Your code so far

// The global variable
var globalTitle = "Winter Is Coming";

// Only change code below this line
function urlSlug(title) {
title = title.toLowerCase().split(/\s*\s/).join('-');
return title
// Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

This is the output I show for the one test-case you aren’t passing. :slight_smile:

1 Like

thanks! now I undestood! :smiley: