Strings In Depth8 / 18
Up next

split and join

// split returns string[]; join glues the pieces back together
function slug(title: string): string {
  return title.toLowerCase().split(" ").join("-");
}

console.log(slug("Hello World Example"));
What you're solving

text to array and back with a typed helper