Convert strings to Url slugs in javascript code

Tell us what’s happening:
Describe your issue in detail here.

i wrote this code. output of this code is correct according to problem. but Freecodecamp editor shows wrong for one string . please look into this code tell me what was the wrong.
Your code so far

// Only change code below this line
function urlSlug(title) {
return title
.toLowerCase().trim().split(" ").reduce(function(hyphen,curword){
  return hyphen+"-"+curword;

// Only change code above this line
var a = urlSlug("    Winter Is Coming");

      **Your browser information:**

User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.56</code>

**Challenge:**  Apply Functional Programming to Convert Strings to URL Slugs

**Link to the challenge:**

Hi @harishhoney208 ,

The test which fails has double spaces between ‘Is’ and ‘Coming’.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.