title: JS Timer with setTimeout get a "Uncaught SyntaxError: Unexpected token ("
body: <p>I've been trying to make a JavaScript timer using the setTimeout() command.
  When i look at it in the browser console returns "Uncaught SyntaxError: Unexpected token (".</p>
  
  <p>Also you can see the code here: <a href="http://mathiakiaer.site88.net/timer/" rel="nofollow">http://mathiakiaer.site88.net/timer/</a></p>
  
  <p>This is the HTML code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Timer&lt;/title&gt;
          &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
          &lt;script src="script.js" type="text/javascript"&gt;&lt;/script&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;article&gt;
              &lt;p id="timerTime"&gt;&lt;span id="timerTimeMinutes"&gt;00&lt;/span&gt;:&lt;span id="timerTimeSeconds"&gt;00&lt;/span&gt;&lt;/p&gt;
              &lt;button id="timerStart" onclick='repeatTimer()'&gt;START&lt;/button&gt;
              &lt;div id="timerChangeDiv"&gt;
                  Minutes: &lt;input id="timerInputMinutes" value="0" type="number" min="0" max="60"&gt;&lt;br&gt;
                  Seconds: &lt;input id="timerInputSeconds" value="0" type="number" min="0" max="60"&gt;&lt;br&gt;
                  &lt;button onclick="setTime()"&gt;Change Time&lt;/button&gt;
              &lt;/div&gt;
          &lt;/article&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is the JavaScript code:</p>
  
  <pre><code>var seconds=0;
  var minutes=0;
  function countDown() {
      if(seconds!==0) {
          repeatTimer();
          seconds--;
      } else {
          if(minutes!==0) {
              minutes--;
              seconds=59;
              repeatTimer();
          } else {
              alert("The timer is done");
          }
      }
      refresh();
  }
  function repeatTimer() {
      setTimeout("function() {countDown();}", 1000);
  }
  function setTime() {
      seconds=parseInt(document.getElementById("timerInputSeconds").value);
      minutes=parseInt(document.getElementById("timerInputMinutes").value);
      document.getElementById("timerInputSeconds").value=0;
      document.getElementById("timerInputMinutes").value=0;
      refresh();
  }
  function refresh() {
      if(seconds&gt;9) {
          document.getElementById("timerTimeSeconds").innerHTML=seconds;
      } else {
          var secondsShow="0" + seconds;
          document.getElementById("timerTimeSeconds").innerHTML=secondsShow;
      }
      if(minutes&gt;9) {
          document.getElementById("timerminutes").innerHTML=minutes;
      } else {
          var minutesShow="0" + minutes;
          document.getElementById("timerTimeMinutes").innerHTML=minutesShow;
      }
  }
  </code></pre>