Please help. I don’t know what I need to do to pass this challenge. I’m failing this test.
urlSlug(" Winter Is Coming") should return "winter-is-coming".
And here is my code.
// the global variable
var globalTitle = "Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
let hyphenStr = title.toLowerCase().split(" ").join("-");
return hyphenStr;
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
console.log(winterComing);
Apply Functional Programming to Convert Strings to URL Slugs