10. Slugify a String

Write a function `slugify` that takes a string and returns a URL-friendly version of it. The result should be lowercase, spaces replaced with dashes, and all non-alphanumeric characters removed (except dashes).

Examples:

Input: slugify("Hello World!")
Output: "hello-world"
Explanation: Lowercased, cleaned, and dashed.
Input: slugify("Clean-This Title!!")
Output: "clean-this-title"
Explanation: Retains dash and removes punctuation.
SolutionJavaScript
Test Results
Click "Run Code" to test your solution