Convert strings to URL slugs

Challenge Link: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs
I’ve completed the challenge alright;
But I think am using one too many lines for it. Am I wrong or Is there a shorter, simpler way of doing it?
My code:

function urlSlug(title) {
  let newArray = title;
  newArray = newArray.trim();
  newArray = newArray.split(/\s+/);
  newArray = newArray.join("-");
  newArray = newArray.toLowerCase();
  return newArray;
}

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, please just offer suggestions and examples instead of posting a full working solution. We are here to guide other campers, not to post full solutions. For example, your comments without the code would have been enough information.

Thank you.

I apologise. I must have forgotten to put the spoiler tags. It was unintentional.