Say I have the following variables
example1 = 1
example2 = 32
example3 = 3345
etc all the way to something big, like
example100 = 222
I want to append each number into a separate div, each div labelled:
<div class = "exam1"> </div>
<div class = "exam2"> </div>
etc all the way to exam100
How can I do this using a for loop?
for ( var i = 1; i < 100; i++ ) {
$(".exam"+i).empty();$(".age-"+i).append( **????** );
}
I just don't know how to add a number i onto the end of a variable so that it will work, any ideas?
/example(\d+)/replace withexample[$1]. Then, add an array declaration at the top of your JSvar example = [];