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

Function - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Function

*

20157

*

Function JavaScript Function

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

length

name

prototype

function new

Function.prototype.apply()

this

Function.prototype.bind()

this

Function.prototype.call()

this

Function.prototype.toString()

Object.prototype.toString

Function.prototype[Symbol.hasInstance]()

instanceof

Function

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

Node.js f1() x ReferenceError Node x

ECMAScript 2027 LanguageSpecification
# sec-function-objects


Web Proxy Viewer  |  New URL  |  Original Page