Z31o_0
11/12/2019 - 9:41 AM

capitalize

This snippet capitalizes the first letter of a string.

const capitalize = ([first, ...rest]) => first.toUpperCase() + rest.join('');
  
capitalize('fooBar'); // 'FooBar'
capitalize('fooBar', true); // 'FooBar'