Tell us what’s happening:
I can’t figure out why my code won’t work. The outputs appear to match the outputs that the challenge requires. Cna someone help me out?
Your code so far
// the global variable
var globalTitle = "Winter Is Coming";
// Add your code below this line
function urlSlug(title) {
var lower = title.toLowerCase();
var arr1 = lower.split(" ");
var arr2 = arr1.join("-");
return arr2;
}
// Add your code above this line
var winterComing = urlSlug(globalTitle); // Should be "winter-is-coming"
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs