I tried my best to make it work but for some reason the .trim doesn’t shave off the first extra space. If anyone has some advice or a tip please let me know. Thanks!
Your code so far
// Only change code below this line
function urlSlug(title) {
let slu = title.trim().toLowerCase().split(' ').join('-');
return slu;
}
// 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 Edg/92.0.902.73
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
Since you’ve got a pretty good functional approach going, I’d go with ‘filter’. The callback function actually ends up being really straightforward once you see what it is