Skip to content

Instantly share code, notes, and snippets.

@jamesholcomb
Created June 27, 2017 22:32
Show Gist options
  • Save jamesholcomb/0029ef3f5b37f67930818abe42790fdd to your computer and use it in GitHub Desktop.
Save jamesholcomb/0029ef3f5b37f67930818abe42790fdd to your computer and use it in GitHub Desktop.
Get function name from inside scope
const myCoolFunc = () => {
const name = new Error().stack.match(/at (.*?) /)[1]
console.log(name) // myCoolFunc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment