title: Keep track of function calls in JavaScript
body: <p>Is there a good way to keep track of called functions in JavaScript? At the moment, the only way I can think of is to keep global array to store functions that are called and within each function append the function name and values of the parameters into the array every time it is called. </p>
  
  <p>For instance</p>
  
  <pre><code>var functionCalls = [];
  var functionIndex = 0;
  
  function func1(param1, param2, ... , paramN) {
      ...
      functionCalls[functionIndex] = [func1, param1, param2, ..., paramN];
      functionIndex++;
  }
  
  function func2(param1, param2, ... , paramN) {
      ...
      functionCalls[functionIndex] = [func2, param1, param2, ..., paramN];
      functionIndex++;
  }
  </code></pre>
  
  <p>Is there a better way to do this? Thanks!</p>