How to create a string with a repeated character N times in Node.js

1 Answer

0 votes
const repeated = 'x'.repeat(12); // Repeats 'x' 12 times

console.log(repeated);

 
    
/*
run:
     
xxxxxxxxxxxx
      
*/

 



answered Jul 28, 2025 by avibootz
...