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

javascript capitalize words

//Updated 
//capitalize only the first letter of the string. 
function capitalizeFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
}
//capitalize all words of a string. 
function capitalizeWords(string) {
    return string.replace(/(?:^|s)S/g, function(a) { return a.toUpperCase(); });
};
Comment

find capital word in string javascript

const str = "HERE'S AN UPPERCASE PART of the string";
const upperCaseWords = str.match(/([A-Z][A-Z]+|[A-Z])/g);

console.log(upperCaseWords);
Comment

js capitalize word

const capitalizeFirstLetter(string) => 
	string.charAt(0).toUpperCase() + string.slice(1).toLowerCase()
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 :: why does my page reloads on form submission 
Javascript :: js is date 
Javascript :: jquery checkbox 
Javascript :: get element by 
Javascript :: require is undefined 
Javascript :: javascript foreach array of object get value by key 
Javascript :: javascript convert minutes to hh mm 
Javascript :: get status bar height react native 
Javascript :: copy dict js 
Javascript :: jquery ajax form submission 
Javascript :: react, scroll element into view 
Javascript :: regex for month 
Javascript :: javascript every other element in array 
Javascript :: convert json string to json object in java 
Javascript :: play audio javascript 
Javascript :: Redirect replacement in react 
Javascript :: csrf token method 
Javascript :: react router next page top 
Javascript :: js poll dom 
Javascript :: properly import mat icon angular 10 
Javascript :: import createstore from redux 
Javascript :: javascript if field exists 
Javascript :: javascript string contains multiple substrings 
Javascript :: could not resolve module fs react native 
Javascript :: js desktop notification 
Javascript :: javascript tofixed 
Javascript :: indexof vs findindex 
Javascript :: text align in javascript 
Javascript :: javascript check if number is multiple of 3 
Javascript :: throttling function in javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =