DEV Community

Discussion on: Capitalize first letter in every sentence?

Collapse
 
savagepixie profile image
SavagePixie • Edited

word.substr(1) is creating a new string from word starting on the character at index 1. So it's basically the whole word except the first character.

Example:

const str = "potato"
const newStr = str.substr(1) // = "otato"