// the global variable
var globalTitle = " Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
let title_copy = [];
title_copy = title_copy.concat(title);//.toString();
console.log((title_copy));
console.log(typeof(title));
title_copy = title_copy.toString();
console.log(typeof(title_copy));
console.log((title_copy));
console.log(typeof(title));
console.log(title)
return title_copy.toLowerCase().trim().split(/\s+/).join('-');
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
console.log(winterComing);
console.log(globalTitle);`
globalTitle doesn’t change. Yet, it’s telling me it has. What’s going on here?
Even the following solution doesn’t work.
return title.toLowerCase().trim().split(/\s+/).join('-');
It gives me the same feedback that the global variable has changed when it has not.
Why is it doing this?