Skip to content

Instantly share code, notes, and snippets.

@usergenic
Created March 10, 2009 19:49
Show Gist options
  • Save usergenic/77096 to your computer and use it in GitHub Desktop.
Save usergenic/77096 to your computer and use it in GitHub Desktop.
Function.prototype.argumentNames=function(){
return this
.toString()
.replace(/[^(]+\(/,"")
.replace(/\).+/,"")
.match(/[^\n]+/)
.toString()
.split(/, /)
};
var f = function(x,y,z){return x*y/z};
f.argumentNames(); // => ['x','y','z']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment