Fri, 17 May 2024


How to assign a function to a variable with the JavaScript Function contructor?

By: Anton, NetArt Media
Sun, 26 September 2021

var add= new Function("x", "y", "return x + y");

It's absolutely similar to the following function declaration:

function add(x,y)

{
return x+y;

}


Category: Javascript
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox