So I’m trying to pass this challenge
and I came out with this code and it displays the correct, desired result that’s stated in the test but it returns an error.
Here’s the code:
function urlSlug(title) {
return title
.trim()
.toLowerCase()
.split(" “)
.join(”-");
}
Hi,
It’s failing the urlSlug(" Winter Is Coming") should return "winter-is-coming"
test (note the extra spaces between “Is” and “Coming”).
Currently it’s returning winter-is--coming
(note the extra hyphen).
You should figure out a way to remove that extra space, and that should enable you to pass the test.
Let me know if you have any questions
1 Like