You can use the lowerFirst
function from the lodash library to transform the first character of a string to lower case. Follow these steps to use the function:
npm install lodash
in your terminal or by adding <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
to your HTML file.lowerFirst
function by adding const lowerFirst = require('lodash/lowerFirst');
to your JavaScript file or by using import { lowerFirst } from 'lodash';
.lowerFirst
function to transform the first character of a string to lower case like this:index.tsx150 chars5 lines
Alternatively, you can also use the ES6 string.charAt(0).toLowerCase() + string.slice(1)
syntax to achieve the same result without using a library.
gistlibby LogSnag