Challenge programming-to-convert-strings-to-url-slugs

Tell us what’s happening:
as the challenge says , im trying to replace ‘spaces’ with ‘-’ , but i keep getting an error “TypeError: Cannot read property ‘concat’ of undefined”
same thing with push() method with same results, can anyone help with this?
note can solve it with many other ways , i used reduce to practice using it more

Your code so far


// Only change code below this line
function urlSlug(title) {
let s=['-']
return title.split('').reduce((acc,x)=>{if(x!==' '){ acc.concat(x)}else{ acc.concat(s)}},[])

}
// Only change code above this line
console.log(urlSlug("Winter Is Coming"))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0.

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

For reduce, in the callback you have to return the next accumulator value. Here, you’re just trying to modify the accumulator and returning undefined. Since the next accumulator is undefined, it has no concat method.

thank you , i fixed it:)