Publication

Naming Anonymous JavaScript Functions

Claude Petitpierre, Salman Mirghasemi
2011
Report or working paper
Abstract

JavaScript developers create programs by calling functions and they use functions to construct objects. JavaScript development tools need to report to developers about those functions and constructors, for example in debugger call-stacks and in object representations. However, most functions are anonymous: developers need not to specify names for functions. Based on our analysis of ten large, widely used JavaScript projects, less than 7% of JavaScript functions are named by developers. After studying examples from these JavaScript projects, we propose \textit{Static Function-Object Consumption}, a principled, automated approach based on local source code analysis for providing names to nameless JavaScript functions. We applied our approach to 90000 anonymous functions that appeared in the analyzed JavaScript project. The approach is successful in naming more than 99% (91% are unique within their file) of anonymous functions while the average length of function names is kept less than 37 characters.

About this result
This page is automatically generated and may contain information that is not correct, complete, up-to-date, or relevant to your search query. The same applies to every other page on this website. Please make sure to verify the information with EPFL's official sources.