How to display n the number of elements in React?

0 like 0 dislike
4 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 | 4 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
33,907 users