This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
In this article, you will learn how to capitalise first letter using Lodash.
Let’s say you have a string variable named ‘a’ with value “codesource.io”.
// Import Lodash library
import _ from "lodash";
var a = "codesource.io";
In order to capitalise first letter in string using Lodash, you can use the _.capitalize()
method.
// Import Lodash library
import _ from "lodash";
var a = "codesource.io";
console.log(_.capitalize(a));
Note: The _.capitalize()
method functions by converting the first letter of a string to uppercase and the others to lowercase.
The post How to Capitalise First Letter in String Using Lodash appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
Ariessa Norramli | Sciencx (2021-02-19T09:16:59+00:00) How to Capitalise First Letter in String Using Lodash. Retrieved from https://www.scien.cx/2021/02/19/how-to-capitalise-first-letter-in-string-using-lodash/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.