title: javascript function call - nested functions
body: <p>I am trying to implement the following in js:</p>
  
  <pre><code>    function Stack() {
          var top = null;
          var count = 0;
  
          //returns the total elements in an array
          this.getCount = function() {
              return count;
          }
  
          this.Push = function(data){
              var node = {
                  data: data,
                  next: null
              }
  
              node.next = top;
              top = node;
              count++;
  
              console.log("top: " + top,"count: " + count); 
          }
  
      }
  
      Stack.Push(5);
  </code></pre>
  
  <p>The call to Stack.Push is throwing an error, I think it is function scoping, right? How can I make the call to the push method?</p>