Skip to content

Instantly share code, notes, and snippets.

@TravelingTechGuy
Created August 27, 2011 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TravelingTechGuy/1175226 to your computer and use it in GitHub Desktop.
Save TravelingTechGuy/1175226 to your computer and use it in GitHub Desktop.
Display JavaScript function name
function reportName() {
var fname = /^function\s+([^(]+)/.exec(reportName.caller.toString())[1];
console.log(fname);
}
function MyFunctionHAsALongName() {
reportName();
//Do some stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment