Hi. Im doing this assigment and my solution seems to be working, however it doesn’t pass The globalTitle
variable should not change test
My code:
// the global variable
var globalTitle = " Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
console.log(title);
let tempTitle = title;
let newArr = tempTitle.split(" ").filter( (a) => a!='').map((a) => a.toLowerCase());
console.log(newArr);
let newStr = newArr.join('-');
console.log(title);
return newStr;
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
I used console for debugging but the string seem the be same? What my code cannot pass this test?