Languages
[Edit]
EN

JavaScript - get function name

7 points
Created by:
Lilly-Grace-Greig
571

In this article, we would like to show how to get function name in JavaScript.

Quick solution (use name property):

Note: be careful using function names with transpilers or minifiers that may change function names.

 

Practical example

Edit

In JavaScript we can create a function in few ways:

  • function myFunction() { }
  • const myFunction = function FunctionName() { }
  • const myFunction = function() { }
  • const myFunction = () => { }

Runnable code: 

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join