I\'m looking through the lodash docs and other Stack Overflow questions - while there are several native JavaScript ways of accomplishing this task, is there a way I can convert
There are mixed answers to this question.
Some are recommending using _.upperFirst
while some recommending _.startCase
.
Know the difference between them.
i) _.upperFirst
will transform the first letter of your string, then string might be of a single word or multiple words but the only first letter of your string is transformed to uppercase.
_.upperFirst('jon doe')
output:
Jon doe
check the documentation https://lodash.com/docs/4.17.10#upperFirst
ii) _.startCase
will transform the first letter of every word inside your string.
_.startCase('jon doe')
output:
Jon Doe
https://lodash.com/docs/4.17.10#startCase