JavaScript - Persistent data in function between calls?
问题 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? Edit: Here's more info on what I'm trying to achieve... 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