Sign In Register

How can we help you today?

Start a new topic

cloudcode call function from string

Is there anyway I can do something like this in cloud code?


var functionName = "randomname";

functionName(args);


or

var functionName = "randomname";

window[functionName](args);


or

var functionName = "randomname";

eval(functionName)(args);


function randomname(){

//do something;

}


If nothing else I will just use a switch case, even though its messy.

1 Comment

Hi d deo,


We don't support the window function in Cloud Code unfortunately so the best way of achieving this is through the eval method. 


-Pádraig

Login to post a comment