Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016년 8월.
Function 인스턴스의 name 속성은 함수가 생성될 때 지정된 대로 함수의 이름을 나타내거나 익명으로 생성된 함수의 경우 anonymous 또는 ''(빈 문자열)일 수 있습니다.
문자열.
| 쓰기 가능 | 불가능 |
| 열거 가능 | 불가능 |
| 설정 가능 | 가능 |
참고 : 비표준, ES6 이전 구현에서는 configurable 속성 또한 false 였습니다.
name 속성은 함수 이름 또는 (ES6 구현 이전) 익명(anonymous) 함수에 대해서는 빈 문자열을 반환합니다.
new Function(...) 또는 그냥 Function(...) 구문으로 생성된 함수는 name 속성을 빈 문자열로 설정합니다. 다음 예에서는 익명 함수가 생성되므로 name은 빈 문자열을 반환합니다:
ES6 함수를 구현한 브라우저는 익명 함수 이름을 그 구문상 위치로부터 추측할 수 있습니다. 예를 들어:
function 식에서 이름으로 함수를 정의할 수 있습니다:
함수 이름은 바꿀 수 없습니다, 이 속성은 읽기 전용입니다:
그러나 바꾸려면, Object.defineProperty()를 사용할 수 있습니다.
객체의 'class'를 확인하기 위해 obj.constructor.name을 사용할 수 있습니다:
| ECMAScript® 2027 Language Specification # sec-function-instances-name |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 2월 11일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.