title: Timer in a local scope variable in javascript
body: <p>The timer must be initialized and the seconds have to be incremented each second. Can someone help me? I am not sure what is going on.</p>
  <pre><code>function timer(){
      let seconds = &quot;00&quot;;
      let minutes = &quot;00&quot;;
      let hours = &quot;00&quot;;
      let fulltime = `${hours}:${minutes}:${seconds}`;
  
      const incrementSeconds = () =&gt; {
          secondsAsNumber = parseInt(seconds) + 1;
          seconds = secondsAsNumber.toString();
      }
      
      const displayTime = () =&gt; {
          console.log(fulltime);
      }
      
      setInterval(() =&gt; {
          incrementSeconds();
          displayTime();
      }, 1000);
  }
  
  timer();
  </code></pre>
  <p>It logs:</p>
  <pre><code>00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  00:00:00
  </code></pre>