How to uppercase (capitalize) the first letter (character) of a string in Node.js

2 Answers

0 votes
function UppercaseFirstCharacter(s) {
    return s.charAt(0).toUpperCase() + s.slice(1);
}
  
let s = 'node.js programming language';
   
s = UppercaseFirstCharacter(s);
   
console.log(s);
   
   
  
   
/*
   
run:
   
Node.js programming language
   
*/

 



answered Mar 18, 2024 by avibootz
0 votes
function UppercaseFirstCharacter(s) {
    return s.charAt(0).toUpperCase() + s.substring(1)
}
  
let s = 'node.js programming language';
   
s = UppercaseFirstCharacter(s);
   
console.log(s);
   
   
  
   
/*
   
run:
   
Node.js programming language
   
*/

 



answered Mar 18, 2024 by avibootz
...