How to create a function using function constructor?

Q

How to create a function using function constructor?

✍: Guest

A

The following example illustrates this. It creates a function called square with argument x and returns x multiplied by itself.

var square = new Function ("x","return x*x");

2011-08-16, 3551👍, 0💬