Apply Functional Programming to Convert Strings to URL Slugs problem

Tell us what’s happening:
plz help i don’t know what is missing in my code to pass this challenge every criteria is satisfied except " The globalTitle variable should not change."

but i checked and the ‘globalTitle’ is not changed
still this criteria is unfulfilled.

Your code so far


// The global variable
var globalTitle = "     Winter Is    Coming  ";

// Only change code below this line
function urlSlug(title) {
return title.split(/\s+/)
.filter(nospace => nospace !== '').join('-')
.toLowerCase();


}
// Only change code above this line
var res = urlSlug(globalTitle)
console.log(res)
console.log(globalTitle)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36.

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

You added a bunch of white space to globalTitle.

It’s supposed to be unchanged, and say "Winter Is Coming"

1 Like

Thankx , how silly i was :sweat_smile:

1 Like