title: JavaScript - Persistent data in function between calls?
body: <p>I want to call a function with an argument and store the value so that next time I call that function without arguments it uses the last argument that was set. Is this possible with JavaScript?</p>
  
  <p>Edit: Here's more info on what I'm trying to achieve...</p>
  
  <pre><code>var track = 0;
  $.getJSON('songsMetadata.json', function(data){
      appendData(data);
  });
  player.bind("ended", function(){
      track++
      appendData();
  });
  function appendData(data){
      /* Here I want to populate 
       the inside 'data' argument 
      only once (in the callback of 
      getJSON) and use that same
      data in the 'player.bind' 
      callback */
  
      //Some code to append data[track] to an HTML list
  }
  </code></pre>