How to lowercase a string and then capitalize only the first letter in Node.js

1 Answer

0 votes
let str = 'nodeJS C++ C PHP';

str = str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();

console.log(str);

  
  
  
  
/*
run:

Nodejs c++ c php
  
*/

 



answered May 15, 2022 by avibootz
...