Here is a quick code snippet I use to capitalize the first letter in a string.
// Capitalize the first letter of a string
const capitalize = (text) => `${text.charAt(0).toUpperCase()}${text.slice(1)}`;console.log(capitalize("here is some text"));
// Here is some text
This will take the first letter of the string and uppercase the letter. Then it will concatenate the rest of the string without the first letter.
Originally published at https://paulund.co.uk.