Apply Functional Programming to Convert Strings to URL Slugs--globalTitle test

Tell us what’s happening:

My code fails the “globalTitle variable should not be changed”, however it’s indeed not changed. Also, if i paste the code from the hint it fails that test as well.

Your code so far

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

// Add your code below this line
function urlSlug(title) {
  return title.split(/\W/).filter(x=> x!=="").join("-").toLowerCase();
// Add your code above this line

var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0.

Link to the challenge:

It was changed.

"Winter Is  Coming"

See? There’s an extra space.

oh wow thanks! I’ve changed it out of laziness so I can test the code and apparently forgot about it. Seems like a good time for a break.