How to display n the number of elements in React?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
6 views
I have a kind of count variable. I need to put a variable in template html elements to count. For example, if count = 4, then the template should be equal to = "". How to implement it?
by | 6 views

2 Answers

0 like 0 dislike
let count = 4 let template = Array(count).fill('').join(") console.log(template) // -> 


or this:
let template2 = ''.repeat(count)
by
0 like 0 dislike
while (i <= count) { template = template + "" i++ }
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,648 users