Hello,
I’m passing all tests except the first one. It seems as though I am inadvertently affecting the globalTitle variable but I don’t see how. I added an additional variable layer “str
” and consoled the heck out of it and it always seems to match the original.
Thoughts?
-J
// the global variable
var globalTitle = " Winter Is Coming";
function urlSlug(title) {
let str = title;
let str1 = str.toLowerCase().split(" ").filter(fun).join("-");
console.log(globalTitle);
return str1;
}
console.log(globalTitle);
function fun(text){
return text != "";
}
console.log(globalTitle);
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"