title: Why isn't setInterval() returning my function's return value?
body: <p>I'm very new to coding (2 weeks experience) so please bare with my silly question about this code. Ultimately I want it to continuously run the function called "timer," which tells me how long it took to run the function called "add," display that result on my screen, and then update that results each time it runs. </p>
  
  <pre><code>function add(a,b){ 
    return a + b;
  }
  
  function timer(){
    var a = Math.floor(Math.random() * 101);
    var b = Math.floor(Math.random() * 101);
    var start = performance.now();
    add();
    var end = performance.now();
    var duration = end - start;
    return duration + ' milliseconds';
  }
  
  t = setInterval(timer,1000);
  </code></pre>
  
  <p>What this seems to do is return the number "1" and do nothing after. </p>
  
  <p>Now when I replace </p>
  
  <pre><code>return duration + ' milliseconds' 
  </code></pre>
  
  <p>with </p>
  
  <pre><code>console.log(duration + ' milliseconds') 
  </code></pre>
  
  <p>it does what I want, except for the fact that the reason I don't want to use console.log is that it jumps to a new line when displaying the duration instead of replacing the previous line with the new duration. To clarify, I don't want a big list of durations that gets longer every time it runs, I just one one duration displayed, that gets updated and replaced each time it runs. </p>
  
  <p>Thank you for your help!</p>