Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to capitalize the first letter of a word in JavaScript

const word = "freecodecamp"

const capitalized =
  word.charAt(0).toUpperCase()
  + word.slice(1)
  
// Freecodecamp
// F is capitalized
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #How #capitalize #letter #word #JavaScript
ADD COMMENT
Topic
Name
1+5 =