How can I execute a Javascript function such this:
cursor.continue(parameters)
By using a string to identify the function name, without using eval? Something like this:
cursor.callMethod("continue", parameters);
Is this possible?
How can I execute a Javascript function such this:
cursor.continue(parameters)
By using a string to identify the function name, without using eval? Something like this:
cursor.callMethod("continue", parameters);
Is this possible?
 
    
    Yes, you can use the square bracket notation.
cursor["continue"](parameters)
cursor["continue"] is exactly the same as cursor.continue.
 
    
    If you are in control of callMethod, and the function belongs to an object or is global, then yes, that's possible.
For example, if the target function is a method of the same object where callMethod is:
var cursor = {
    callMethod: function(method, params) {
        this[method].apply(this, params);
    },
    continue: function() {}
}
cursor.callMethod("continue", [1, 2, 3]);
 
    
    Yes, you can call the function like so:
cursor["continue"](parameters);
