Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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(" ");
}
Comment

how to convert string to reverse title case in javascript

const reverseTitleCase = (string) => {
  const newText = string
    .toLowerCase()
    .split(" ")
    .map(function(item) {
      return item.slice(0, -1) + item.slice(-1).toUpperCase();
    })
    .join(" ");
  
  return newText;
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: nlhoman json load from file 
Javascript :: js pick last element of array 
Javascript :: shopify liquid logic 
Javascript :: assing multipe ids jquery to event 
Javascript :: js how to get n fibonacci number 
Javascript :: Jenkins parse json keep order 
Javascript :: how dynamique pseudo element in react 
Javascript :: JavaScript Rules for Naming JavaScript Variables 
Javascript :: eleventy filter newlines 
Javascript :: javascript Adding Element to the Outer Array 
Javascript :: javascript arrow function syntax 
Javascript :: javascript remaining elements of an array to a variable using the spread syntax 
Javascript :: javascript Deleting an object is not allowed 
Javascript :: javascript maps 
Javascript :: httpclient post raw json body 
Javascript :: nodjs : Stream for big file 
Javascript :: mongoose findbyidandupdate or findoneandupdate 
Javascript :: roman to integer fastest way 
Javascript :: connect phantom wallet react typescript 
Javascript :: phaser create animation on sprite 
Javascript :: lookbehind alternative regex 
Javascript :: multiple pagination angular material 
Javascript :: declare 2 d vector js 
Javascript :: white space below image next image 
Javascript :: jquery selectors 
Javascript :: fibonacci sequence array 
Javascript :: javascript methods 
Javascript :: anonymous function 
Javascript :: dayjs subtract days 
Javascript :: postgres json 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =