Capitalize the first letter of a string This snippet capitalizes the first letter of a string. const capitalize = ([first, ...rest]) => first.toUpperCase() + rest.join(''); capitalize('fooBar'); // 'FooBar' capitalize('fooBar', true); // 'FooBar' Source https://morioh.com/p/5b34d9858cb5