JavaScript run code before a function
<p>How can I execute some javascript before running a function? I have tried doing something like this:</p>

<pre><code>Function.prototype._call= Function.prototype.call;
Function.prototype.call = function(src) {
    console.log('A function was called name = ', src)
    Function.prototype._call(src);
}
</code></pre>

<p>But that only works when I use</p>

<pre><code>myfunction.call()
</code></pre>

<p>And I want the code to work when I call any function normally eg:</p>

<pre><code>myfunction()
</code></pre>