I can’t figure out how to remove all whitespace from a string. I tried Googling, but I only get stuff showing how to do it using replace
(the challenge says my should not use replace
).
Any help is appreciated.
My code so far
// The global variable
var globalTitle = "Winter Is Coming";
// Only change code below this line
function urlSlug(title) {
return title.trim().toLowerCase().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/83.0.4103.116 Safari/537.36 Edg/83.0.478.64
.
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
Link to the challenge: