| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function | [Back] [Original] |
Get to know MDN better
Function() Function eval() eval() Function
Function.prototype Function
Function.prototype.arguments Function.prototype.caller caller TypeError
Function.prototype.constructor Function Function
Function
displayName lengthnameprototype function new
Function.prototype.apply()Function.prototype.bind() this
Function.prototype.call() this
Function.prototype.toString()Function.prototype[Symbol.hasInstance]() Function Function eval()
// `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 |
FunctionObject/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()| Web Proxy Viewer | New URL | Original Page |