Even if I copy one of the correct solutions FCC console tells me I’m modifying the global variable… which I’m not according to the browser console. Am I doing something wrong or is this a bug?
// the global variable
var globalTitle = " Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
return title.split(/\s+/)
.filter(elem => elem) //Remove trailing whitespace (or use trim())
.join("-")
.toLowerCase();
}
// Add your code above this line
console.log(globalTitle);
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
console.log(winterComing);
console.log(globalTitle);