The freeCodeCamp compiler is saying:
urlSlug(" Winter Is Coming") should return “winter-is-coming”.
But when I run it in Atom, I do get “winter-is-coming”.
Here is my code:
// the global variable
var globalTitle = "Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
return title.split(/\s+/g).map(x => x = x.toLowerCase()).join("-");
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
console.log(winterComing);