Favorites

JavaScript Function.prototype.name Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Function.prototype.name
JavaScript Function Instance propertyThis property is supported by all modern browsers.
Updated 28th November 2026

The name property of a function holds its name, which is shown in stack traces and debugging tools.

Description

The read-only name property returns the function's name. Anonymous functions assigned to a variable or property take that name automatically. Bound functions get a "bound " prefix. Don't rely on it in production code, because minifiers usually change names.

Class methods, getters and setters also have names; getters and setters are prefixed with "get " or "set ". Functions created with new Function() are named "anonymous".

The name appears in stack traces and in the developer tools' call stack, so naming functions, even callbacks, makes debugging easier. The property is read-only, but can be changed with Object.defineProperty(), which some libraries do for generated functions.

Syntax

func.name

Value

A string: the function's name, or an empty string for anonymous functions.

Example

function save() {}
const load = () => {};
console.log(save.name, load.name);
console.log(save.bind(null).name);
console.log((() => {}).name === '');

Browser Support

The following information will show you the current browser support for the Function.prototype.name property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee