I'm using javascript and JQuery.
let's assume there's an array, ListArray and it's got a bunch of sentences inside. Simple.
Can I somehow do this?
var List = for (var i = 0; i < 10; i++) {
//loop through an array here to generate the contents
}
I need to generate a lot of list groups, and within each of those list groups, generate a list, and the lists' contents are stored in an array.
So how can I generate this list from the array and store it in that variable?
the variable should have an outcome of
var List = "<p>Some content from an array</p><p>Some content from an array</p><p>Some content from an array</p>";
To be clear, I'm asking if it's valid to put an for loop within a variable in JS.