Skip to content

Instantly share code, notes, and snippets.

@hasanuzzamanbe
Created July 25, 2020 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasanuzzamanbe/d9256ed4cd2751e6d172a39aea4983e7 to your computer and use it in GitHub Desktop.
Save hasanuzzamanbe/d9256ed4cd2751e6d172a39aea4983e7 to your computer and use it in GitHub Desktop.
Make slug to string
function makeTitle(slug) {
var words = slug.split('-');
for (var i = 0; i < words.length; i++) {
var word = words[i];
words[i] = word.charAt(0).toUpperCase() + word.slice(1);
}
return words.join(' ');
}
// makeTitle(lorem-ipsum) expected output: Lorem Ipsum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment