Apply Functional Programming to Convert Strings to URL Slugs - issue with replace() method

My solution is working but I get this message:
Your code should not use the replace method for this challenge.
despite replace() method is not in my code

function urlSlug(title) {

let convert = title
.split(' ')
.filter(elem => elem !== '')
.join('-')
.toLowerCase();

return convert;
}

urlSlug(" Winter Is Coming")

Thanks in advance for your help!

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36.

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

I have found the issue. My solution is fine but the word replace() was in my comments and that’s why I didn’t pass the test
:sweat:

1 Like