Hello, i cant understand why didnt my code pass tests. Can you help me understand)
/ the global variable
var globalTitle = “Winter Is Coming”;
// Add your code below this line
function urlSlug(title) {
var arr=title.split(/\s+/);
for (let i=0;i<arr.length;i++) {
arr[i]=arr[i].toLowerCase();
}
return arr.join("-");
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be “winter-is-coming”
console.log(winterComing);