// 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"));
text to array and back with a typed helper