Question: So I have this script that is a counter that follows an infinite animation. The counter resets to 0 everytime an interation finishes. On the line fourth from the bottom I am trying to invoke a x.classList.toggle() to change css when the counter hits 20. When I replace the classList.toggle with an alert() function it works, but as is no class 'doton' is added to 'dot1'. What am I missing?

<http://jsfiddle.net/8TVn5/>

```
window.onload = function () {

var currentPercent = 0;

var showPercent = window.setInterval(function() {

    $('#dot1').on('animationiteration webkitAnimationIteration oanimationiteration     MSAnimationIteration', function (e) {
  currentPercent= 0;}); 

   if (currentPercent < 100) {
   currentPercent += 1;
  } else {
    currentPercent = 0;
 }

   if (currentPercent == 20){document.getElementByID('dot1').classList.toggle('doton');}
    document.getElementById('result').innerHTML = currentPercent;
}, 200);

};

```

Answer: 
You can't append a `list` to a `tuple` because tuples are ["immutable"](http://docs.python.org/2/library/functions.html#tuple) (they can't be changed). It is however easy to append a *tuple* to a *list*:

```
vertices = [(0, 0), (0, 0), (0, 0)]
for x in range(10):
    vertices.append((x, y))

```

You can add tuples together to create a *new*, longer tuple, but that strongly goes against the purpose of tuples, and will slow down as the number of elements gets larger. Using a list in this case is preferred.
You probably want a list, as mentioned above. But if you really need a tuple, you can create a new tuple by concatenating tuples:

```
vertices = ([0,0],[0,0],[0,0])
for x in (1, 2):
    for y in (3, 4):
        vertices += ([x,y],)

```

Alternatively, and for more efficiency, use a list while you're building the tuple and convert it at the end:

```
vertices = ([0,0],[0,0],[0,0])
#...
vlist = list(vertices)
for x in (1, 2):
    for y in (3, 4):
        vlist.append([x, y])
vertices = tuple(vlist)

```

At the end of either one, `vertices` is:

```
([0, 0], [0, 0], [0, 0], [1, 3], [1, 4], [2, 3], [2, 4])

```