Question: I have 6 numbers on a page, each inside of it's own div with a class of 'interval'. I need to decrement the innerHTML of EACH of the integers inside of the DIV with a singular javascript method.. Here's the html:

```
<div class="timer">54</div>
<div class="timer">98</div>
<div class="timer">100</div>
<div class="timer">24</div>
<div class="timer">8</div>
<div class="timer">16</div>

```

Here's my attempted JavaScript:

```
$(document).ready(function () {

    var intervalCountDown = window.setInterval(decrementTimeRemaining, 1000);

    function decrementTimeRemaining() {
       $('.timer').html($(".timer").html() - 1);
    }

});

```

The expected output (after 1 second) would be 53, 97, 99, 23, 7, 15. Each second these numbers would decrement again.. Instead what's happening is that after the first second, EVERY element with the timer class becomes 53, and then they're all concurrent decrement.

Answer: 
Use [`.html(function)`](https://api.jquery.com/html/#html-function):

```
$('.timer').html(function(index, html) {
  return html - 1;
});

```

In your case you can also use [`.text(function)`](https://api.jquery.com/text/#text-function):

```
$('.timer').text(function(index, text) {
  return text - 1;
});

```

Note that each value is a string `"54"`, `"98"`, ... and will therefore need to be casted to numbers, this happens automatic when using the unary minus (`-`) operator, but wont happen if you use the unary plus (`+`) operator, because it's also the concatenation operator:

```
"2" - 1 // 1
"2" + 1 // "21"

```

Take a look at [`parseInt(string, radix)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt)
Use this function:

```
function decrementTimeRemaining() {
   $('.timer').each(function(idx, value) {
       $(value).html(parseInt($(value).html()) - 1);
   });
}

```