title: access functions outside the class in javascript
body: <p>My class structure is something like this:</p>
  
  <pre><code>var jpTWUI = function(id, connection){
      this.id = id;
      this.muteButton = "#mute";
      this.hangupButton = "#hang";
      this.transferButton = "#trans";
      this.parentElement = jQuery('#timerCon');
      this.connection = connection;
  
      this.interval = "";
  
      this.createElements();
      this.addEvents(); 
  };
  
  jpTWUI.prototype = { 
      createElements: function(){ ... }, 
      addEvents: function(){...}, 
      startTimer: function(){...}
  }
  </code></pre>
  
  <p>Now I have created an object and called the class something like this</p>
  
  <pre><code>var callHandler = new jpTWUI('timerCon', connection);
  callHandler.startTimer();
  </code></pre>
  
  <p>But the problem is that the method <code>startTimer</code> has the <code>setInterval</code> function which display the duration in minutes and seconds.   </p>
  
  <p>I want to implement one more method like <code>stopTimer</code> which stop that <code>startTimer</code>'s interval, I know I have to user <code>window.clearInterval</code>. but when I implemented the function <code>stopTimer</code> in the same class then I don't know how do I access that method with the class like:</p>
  
  <pre><code>var callHandler = new jpTWUI('timerCon', device);
  callHandler.stopTimer();
  </code></pre>
  
  <p>Hope you guys understand what I want to achieve, this is first time I have used the class in javascript..  </p>
  
  <p>Please guide me is this approach is correct?? 
  or how do i make it correct..</p>