How to add N spaces to end of string in TypeScript

1 Answer

0 votes
let str = 'typescript java c c++ php';
 
const N = 5;

str = str + ' '.repeat(N);
 
console.log(str); 
 
    
    
    
    
/*
run:
    
"typescript java c c++ php     " 
    
*/

 



answered Apr 26, 2022 by avibootz

Related questions

1 answer 123 views
2 answers 115 views
1 answer 106 views
1 answer 118 views
1 answer 135 views
...