I am working on the exercise at https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs and my code for the function is:
function urlSlug(title) {
let retStr = title.toLowerCase().split(/\W/).join("-");
return retStr;
}
This code passes all of the tests but one. It fails the test ‘urlSlug(" Winter Is Coming") should return “winter-is-coming”’. I have tested the code and it seems to return the desired string. Why is this code failing this one test?