Tool that detects duplicate javascript function names in a web page?
I have often used JSLINT
In short it is a "compiler" for JavaScript using JavaScript. I have learned a lot by watching Douglas Crockford’s training videos.
It not only checks for duplicate functions, but global variables, and a whole bunch of other things. Like Douglas said in one of his videos it allows you to only use the good bits of JavaScript
Well, using a parser may not always be ideal as it requires an extra step of copying and pasting your code, and everyone else's, into the parser and even then I'm not sure it would catch what you want. The time tested solution to collaborative Javascript development is to namespace your code.
var myNamespace = function (){
var myPrivateProperty;
var myPrivateFunction = function(){};
return{
myPublicProperty: '',
myPublicFunction: function(){}
}
}();
This is based on Douglas Crockford's module pattern.
Then you can call your public functions this way:
myNamespace.myPublicFunction();
And your public properties:
myNamespace.myPublicProperty;
Each developer can develop in their own namespace so as to not step on others' code.