Goal:
Add the name (the name that has even number in the arraylist) in the ordered list.
Problem:
How should I do it with jQuery’s each syntax? you also need to take account to even number.
The array list also can be increased in the future.
var arrayTask = new Array();
arrayTask[0] = "aaa";
arrayTask[1] = 10;
arrayTask[2] = "bbb";
arrayTask[3] = 11;
arrayTask[4] = "bbb";
arrayTask[5] = 12;
arrayTask[6] = "ccc";
<OL id="test">
<LI>
<LI>
<LI>
<LI>
<LI>
<LI>
<LI>
<LI>
<LI>
</OL>
Here’s a quick example of iterating the array and generating new LI items for even indexes.