How to replace the first character in a string with multiple characters in JavaScript

1 Answer

0 votes
let str = 'javascript typescript node.js c';
 
str = 'XYZ' + str.substring(1);
 
console.log(str); 
 
 
   
   
   
   
/*
run:
   
"XYZavascript typescript node.js c"
   
*/

 



answered Jul 3, 2022 by avibootz
...