Why this code can’t clear the whitespace on the left of the string. The challenge needs the string without any whitespace.
but I use trim()
method.
// Only change code below this line
function urlSlug(title) {
return title.toLowerCase().trim().split(" ").join("-");
}
// Only change code above this line
console.log(urlSlug(" Winter Is Coming"));
//urlSlug(" Winter Is Coming") should return the string winter-is-coming
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
.
Challenge: Apply Functional Programming to Convert Strings to URL Slugs
Link to the challenge: