| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Function/Function | [Back] [Original] |
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. Its been available across browsers since 2015 ..
Function Function. , , ( ) Global_Objects/eval. eval, Function , .
const sum = new Function("a", "b", "return a + b");
console.log(sum(2, 6));
// Expected output: 8
new Function(arg1, functionBody)
new Function(arg1, arg2, functionBody)
new Function(arg1, ... , argN, functionBody)
arg1, arg2, ... argN , , . : "x", "theValue = 42", "[a, b] /* numbers */" "x, theValue = 42, [a, b] /* numbers */". ("x, theValue = 42", "[a, b]" , ).
functionBody, JavaScript, .
Function, Function, . function function , .
, , , , . , undefined.
Function ( new) , .
`Function, .
// JavaScript
// , ,
const adder = new Function("a", "b", "return a + b");
//
adder(2, 6);
// 8
"a" "b" , , "return a + b".
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-function-constructor |
This page was last modified on 24 . 2025 . by MDN contributors.
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()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |