[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Function [Back]  [Original]

Function - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Function

Baseline Widely available *

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

* Some parts of this feature may have varying levels of support.

Function . JavaScript Function .

In this article

Function()

Function . eval() ( ) . eval() Function .

Function.prototype Function .

Function.prototype.arguments

. , , arguments TypeError . arguments .

Function.prototype.caller

. , caller TypeError .

Function.prototype.constructor

. Function Function .

Function .

displayName Optional

.

length

.

name

.

prototype

new . .

Function.prototype.apply()

this ( ) .

Function.prototype.bind()

this , .

Function.prototype.call()

this .

Function.prototype.toString()

. Object.prototype.toString .

Function.prototype[@@hasInstance]()

. instanceof .

Function , . Function . eval() .

js
// `var`   
var x = 10;

function createFunction1() {
  const x = 20;
  return new Function("return x;"); //  `x`  `x` 
}

function createFunction2() {
  const x = 20;
  function f() {
    return x; //  `x`    `x` 
  }
  return f;
}

const f1 = createFunction1();
console.log(f1()); // 10
const f2 = createFunction2();
console.log(f2()); // 20

f1() x Node.js ReferenceError . Node x .

Specification
ECMAScript 2027 LanguageSpecification
# sec-function-objects


Web Proxy Viewer  |  New URL  |  Original Page