Hello
nearly 1.5 hour I’m trying to catch what is wrong with my code
the last test which I cant to get is The globalTitle variable should not change.
dose it mean that my code changing the global variable and return not a copy?
Your code so far
// the global variable
var globalTitle = " Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
let str = ''.concat(title)
.split(/\W/)
.filter(a => a !== '')
.join("-")
.toLowerCase();
return str;
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
console.log(winterComing)
console.log(globalTitle)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36.
var globalTitle = "Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
return title.toLowerCase().trim().split(/\s+/).join('-');
}
// Add your code above this line
var winterComing = urlSlug(globalTitle);
This code Exactly works for me …
Go through it you may have some idea