How to repeat a character N times in JavaScript ES6

2 Answers

0 votes
console.log('*'.repeat(5));


/*
run:
     
*****
   
*/

 



answered Mar 11, 2020 by avibootz
0 votes
const s = '*'.repeat(5);

console.log(s);



/*
run:
     
*****
   
*/

 



answered Mar 11, 2020 by avibootz

Related questions

1 answer 122 views
1 answer 158 views
1 answer 74 views
1 answer 184 views
3 answers 246 views
...