Created
August 27, 2011 10:32
-
-
Save TravelingTechGuy/1175226 to your computer and use it in GitHub Desktop.
Display JavaScript function name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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