Is it possible to combine the functions easier?
<p>I need to combine some functions (modify 1st function), but I can't do it this way (it works, but is bad for me):</p>

<pre><code>var a = function(){alert('a');};
var b = function(){alert('b');};
var c = a;
a = function(){c(); b();};
a();
</code></pre>

<p>Then I try to do this:</p>

<pre><code>var a = function(){alert('a');};
var b = function(){alert('b');};
var rx = /^[\s\S]*\(([\s\S]*)\)\s*{([\s\S]*)}$/;
concat = function(f1,f2)
    {
        var q = f1.toString().replace(rx,'$1|$2').split('|');
        var w = f2.toString().replace(rx,'$1|$2').split('|');
        return (q[0]!=='' &amp;&amp; w[0]!=='')?
            new Function(q[0]+','+w[0],q[1]+w[1]):
            (q[0]!=='')?
                new Function(q[0],q[1]+w[1]):
                new Function(w[0],q[1]+w[1]);
    };
a = concat(a,b);
alert(a);
</code></pre>

<p>It works, but may be exist an easier way?</p>
