What does this error message mean?

Tell us what’s happening:
Describe your issue in detail here.
Here is the prompt:
Fill in the urlSlug function so it converts a string title and returns the hyphenated version for the URL. You can use any of the methods covered in this section, and don’t use replace . Here are the requirements:

The input is a string with spaces and title-cased words

The output is a string with the spaces between words replaced by a hyphen ( - )

The output should be all lower-cased letters.

The output should not have any spaces.

  **My code so far**

// Only change code below this line
function urlSlug(title) {
return title
  .toLowerCase()
  .trim()
  .split(/\s+/)
  .join("-");
}
// Only change code above this line
urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone");

And there goes the error: Invariant Violation: function should receive a PolyVinyl, but got [object Object].

Can anyone please help me fixing this? Many thanks!!!

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Apply Functional Programming to Convert Strings to URL Slugs

Link to the challenge:

Hmm, your code works fine for me and passes the challenge. The error message you are getting sounds like it is a problem with the test. I would try using another browser and see if that doesn’t make a difference.

i reloaded the whole page and it works! thank you!!! :sweat_smile:

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