Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

function titleCase 2

function titleCase(str) {
  return str
    .toLowerCase()
    .split(" ")
    .map(val => val.replace(val.charAt(0), val.charAt(0).toUpperCase()))
    .join(" ");
}

titleCase("I'm a little tea pot");
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #function #titleCase
ADD COMMENT
Topic
Name
6+7 =