VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-function-displayname-property/

⇱ JavaScript Function displayName Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Function displayName Property

Last Updated : 15 Jul, 2025

The Function.displayName property in JavaScript is used to set the display name of the function. If the displayName property is used to log the name without setting the displayName property of the function then the output will be undefined.

Syntax:

function.displayName = name

Return Value: It returns nothing instead, it sets the display name of the function.

Note: By default, the display name of the function is undefined.

Example: Below is the basic example of Function.displayName property.

Output:

someName 

A few examples are given below for a better understanding of the function.displayName property.

Example 1: In this example, we will see the basic use of the function.displayName property.

Output:

Display name of the function func1 is : function1

Example 2: In this example, we will see the basic use of the function.displayName property.

Output:

function is : ƒ func() { }
Name of the function func is : func
DisplayName of the function func is : function1

We have a complete list of Javascript Function properties, to check those please go through this article.

Browsers Supported:

  • Google Chrome
  • Mozilla Firefox
Comment