title: Call the lap function in timer
body: <p>I've been bothering on this problem for a while now, I have a timer that has 4 buttons start, stop, reset and lap, when I call <code>Stopwatch.start();</code>, <code>Stopwatch.stop();</code> or <code>Stopwatch.reset();</code> it works just fine but when I'm trying to call <code>Stopwatch.lap();</code> it does not work !</p>
  
  <p>I had the answer before but now I have a new computer and things like that and I can't call the function. The console says "Uncaught TypeError: Stopwatch.lap is not a function" and I can't find the problem.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var Stopwatch = {
  init: function(elem, options) {
  
      var timer       = createTimer(),
              startButton = createButton("start", start),
          stopButton  = createButton("stop", stop),
          resetButton = createButton("reset", reset),
              lapButton   = createButton("lap", lap),
              lapSpan     = createTimer(),
          offset,
          clock,
          interval;
  
      options = options || {};
      options.delay = options.delay || 1;
  
      elem.appendChild(timer);
      elem.appendChild(startButton);
      elem.appendChild(stopButton);
      elem.appendChild(resetButton);
      elem.appendChild(lapButton);
      elem.appendChild(lapSpan);
  
      reset();
  
      function createTimer() {
          return document.createElement("span");
      }
  
      function createButton(action, handler) {
          var a = document.createElement("a");
          a.href = "#" + action;
          a.innerHTML = action;
          a.addEventListener("click", function(event) {
              handler();
              event.preventDefault();
          });
          return a;
      }
  
      function start() {
          if (!interval) {
              offset = Date.now();
              interval = setInterval(update, options.delay);
          }
      }
  
      function stop() {
          if (interval) {
              clearInterval(interval);
              interval = null;
          }
      }
  
      function lap() {
              lapSpan.innerHTML=timer.innerHTML;
          }
  
      function reset() {
          clock = 0;
          render(0);
                  lap();
      }
  
      function update() {
          clock += delta();
          render();
      }
  
      function render() {
          timer.innerHTML = clock / 1000;
      }
  
      function delta() {
          var now = Date.now(),
          d = now - offset;
  
          offset = now;
          return d;
      }
  
          this.getTime=function() {
              return clock;
          }
  
      this.start = start;
      this.stop = stop;
      this.reset = reset;
  }
  };
  var elems;
  window.onload=function() {
     elems = document.getElementsByClassName("basic");
     for (var i = 0, len = elems.length; i &lt; len; i++) {
         Stopwatch.init(elems[i]);
     }
  }
  </code></pre>
  
  <p>And I need to call the lap function when I press a specified key and it looks like this:</p>
  
  <pre><code>document.onkeypress = function(e) {
  e = e || window.event;
  var charCode = e.charCode || e.keyCode,
  character = String.fromCharCode(charCode);
  
  if(e.charCode == 98 || e.keyCode == 98) {
      Stopwatch.start();
  
  } else if(e.charCode == 114 || e.keyCode == 114) {
      Stopwatch.lap();
  
  }
  };
  </code></pre>
  
  <p>I am most familiar with JavaScript and jQuery in this project but I also know HTML and JavaScript.</p>