title: Auto refresh function in javascript
body: <p>I want to auto update function time() in javascript and I have write this code:</p>
  
  <pre><code>var time = null;
  setInterval(function() {
        time = Date();
  }, 1000);
  console.log(time);
  </code></pre>
  
  <p>But it shows me null in console.log. I want to get auto-updated function <code>time()</code> in variable <code>time</code></p>
  
  <p>What is wrong?</p>