Tell us what’s happening:
Describe your issue in detail here.
Can someone please explain what seems to be the problem with my code, though it outputs the desired result?
Your code so far
// Only change code below this line
function urlSlug(title) {
return title
.toLowerCase()
.trim()
.split(" ")
.join("-")
}
// Only change code above this line
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
If you console log what you are returning you will realize that one of you winter is coming is being returned like this: winter-is--coming. Its because it had 2 spaces between 'is ’ and ‘coming’
When you enter a code block into a forum post, precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.