Javascript - Function Constructor (Dynamic Coding)

About

Function can be create from a string as an object constructor with the new keyword

Syntax

new Function ([arg1[, arg2[, ...argN]],] functionBody)

Example

var adder = new Function("a", "b", "return a + b" );
// Call the function
console.log(adder(2, 3));

Documentation / Reference





Discover More
JavaScript - new

The new word indicate a constructor of: an object via: a or a class. See a function. See
Javascript - Object Constructor

in Javascript of an object Invoking a function with the new operator treats it as a constructor. Unlike function calls and method calls, a constructor call passes a brand-new object as the value of this,...
Javascript - (Prototype Model|Prototypical object)

A prototype-based language has the notion of a prototypical object. Any object can: specify its own properties, either when you create it or at run time. be associated as the prototype for another...
Javascript - (Static) Typing (Checker)

in JavaScript. Typing can be added with this method: TypeScript (by Microsoft). in Typescript, Type declaration files express the data types of parameters and functions. - - superset of Javascript...
Javascript - Arrow Function Expression

An arrow function expression has a shorter syntax than a function expression and does not bind its own: this, arguments, super, or new.target. These function expressions are best suited for...
Javascript Function Method
Javascript - Functions

Functions functionalities in Javascript. A function in Javascript is a variable that’s given a reference to the function being declared. The function itself is a value (as an integer or an array) that...
Javascript - Symbol

A symbol is a unique and immutable data type. New in ES6. Usage: Identifier for object properties. Symbol is not a constructor. Type: Symbol Description ...



Share this page:
Follow us:
Task Runner