I have an array with would simbolize parameters of a function.
For Example:
var params = ['name', 'age', 'email'];
and this information is created by another endpoint which return this array. and from this array I would like to create a function like this:
function (name, age, email) {
//...
//my custom code
return result;
}
So as you can see I would like to automatically create functions and use each array element as an argument to that function.
Is there any way to achieve that without using eval?
It seems new Function('name', 'age', 'email', 'fn body') can't be generated on the fly as well.
Thanks in advance