Answers for "title method in javascript"

6

string to title case javascript

function titleCase(sentence) {
  let sentence = string.toLowerCase().split(" ");
  for (let i = 0; i < sentence.length; i++) {
    sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);
  }
  
  return sentence.join(" ");
}
Posted by: Guest on April-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language