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 219 views
1 answer 254 views
1 answer 164 views
1 answer 274 views
3 answers 420 views
...