Question: Say we have a table looking as follows:

```
country    product     order
France     cheese      1
UK         cheese      2
Germany    sausage     3
UK         beer        4
UK         beer        5
France     wine        6
France     pork        7
France     wine        8
Germany    pork        9
UK         butter      10
UK         cheese      11
Germany    pork        12
Germany    butter      13
UK         beer        14
France     cheese      15
UK         cheese      16
Germany    butter      17

```

My aim is to tweak this table so I could get the two more repeated products for each country. If possible, using one single query. The outcome should look like this:

```
country    product   count
France     cheese    2
France     wine      2
UK         beer      3
UK         cheese    3
Germany    pork      2
Germany    butter    2

```

Answer: 
just put `if(timer==30)` instead of `if(timer<30)` so that exactly at count of 30 units of time, you get asked once for confirmation at that instance (However be aware that until the confirmation is done, prompts will keep popping up every second). if you extend it, it will again wait till your timer goes down to 30 unit, else it will simply go down to 0 and break out.
```
function startTimer(duration, display) {
  var timer = duration,
    minutes,
    seconds;

  function timerFunc() {
    timer -= 1;
    minutes = parseInt(timer / 60, 10);
    seconds = parseInt(timer % 60, 10);

    minutes = minutes < 10 ? "0" + minutes : minutes;
    seconds = seconds < 10 ? "0" + seconds : seconds;

    display.textContent = minutes + ":" + seconds;

    if (timer == 30) {
      var message = confirm("Would you like to extend timer?");

      if (message == true) {
        timer = 60;
      } else return alert("Your timer has been stopped.")
    }
     setTimeout(timerFunc, 1000);
  }

  timerFunc();
}

```