Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

uppercase in word javascript

function toTitleCase(str) {
    return str.replace(/wS*/g, function(txt){
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    });
}
Comment

first letter of each word in a sentence to uppercase javascript

function capitalizeTheFirstLetterOfEachWord(words) {
   var separateWord = words.toLowerCase().split(' ');
   for (var i = 0; i < separateWord.length; i++) {
      separateWord[i] = separateWord[i].charAt(0).toUpperCase() +
      separateWord[i].substring(1);
   }
   return separateWord.join(' ');
}
console.log(capitalizeTheFirstLetterOfEachWord("my name is john"));
Comment

uppercase each word javascript

const mySentence = "freeCodeCamp is an awesome resource";

const finalSentence = mySentence.replace(/(^w{1})|(s+w{1})/g, letter => letter.toUpperCase())

console.log(finalSentence)
Comment

PREVIOUS NEXT
Code Example
Javascript :: never give up 
Javascript :: Dynamically load JS inside JS 
Javascript :: swap first and last element in array javascript 
Javascript :: form action using react 
Javascript :: findOne 
Javascript :: json parse vs json stringify 
Javascript :: javascript class in external file 
Javascript :: fetch log api response time 
Javascript :: javascript Modules Always use Strict Mode 
Javascript :: javascript regular expression methods 
Javascript :: nextjs use dotnenv 
Javascript :: circle collision javascript 
Javascript :: react native run android common error 
Javascript :: @hapi/disinfect 
Python :: All caps alphabet as list 
Python :: francais a anglais 
Python :: django template tag to display current year 
Python :: python - show all columns / rows of a Pandas Dataframe 
Python :: get external ip python 
Python :: get path to current directory python 
Python :: how to get the calendar of current month in python 
Python :: download files from google colab 
Python :: python min in dictionary 
Python :: sqlalchemy query bilter by current month 
Python :: python print exception message and stack trace 
Python :: split data validation python 
Python :: cube finder python 
Python :: unix to datetime python 
Python :: python apply a function to a list inplace 
Python :: get python directiory 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =