Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Make first letter of a string uppercase in JavaScript?
To make first letter of a string uppercase, use toUpperCase() in JavaScript. With that, we will use charAt(0) since we need to only capitalize the 1st letter.
Example
function replaceWithTheCapitalLetter(values){
return values.charAt(0).toUpperCase() + values.slice(1);
}
var word="javascript"
console.log(replaceWithTheCapitalLetter(word));
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo167.js.
Output
This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo167.js Javascript
Advertisements
