Source @ github

Function

Function – Creates a Function object.

Description

new Function([string arg, …, string body])

Parameters

Name Description Type Default Optional
arg, … string Yes
body string No

Examples

Example #1 – Function example

Create a new function.

var f = new Function(' return 1;'); console.log(f);

Create a new function with parameters.

var f = new Function('param1', 'param2', ' return param1 + param2;'); console.log(f);

See also

function statement

External references