Tool that detects duplicate javascript function names in a web page?
<p><strong>Background</strong></p>

<p>We have a web application in which several developers have written several .js files that manipulate the DOM and the problem of duplicate function names has crept into our application.</p>

<p><strong>Question</strong></p>

<p>Can anyone recommend a tool that will warn us when we accidentally write a web page with two javascript functions with the same name? </p>

<p><strong>Example</strong></p>

<p><em>HTML page</em></p>

<pre><code>&lt;script language="JavaScript" src="test.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script&gt;function foo() {alert('bar');}&lt;/script&gt;
</code></pre>

<p><em>test.js</em></p>

<pre><code>function foo() {alert('foo');}
</code></pre>

<p>Since foo() is declared twice in the page, apparently only the one that takes precedence is loaded. </p>

<p>The tools I've used seem to ignore this. Firebug only shows the loaded function. Netbeans will show both functions in navigator (without a warning), but only looks at one file at a time (ie, I can't point it at the HTML file and see it and the .js at the same time.) and web developer extensions allows me to look at everything at once, but no errors or warnings. Firefox's error console also throws no warning or error. Neither does IE.</p>

<p>Thanks!</p>
