I have some code where I need to call a function when I have it's name in a string. For example:
var util = {
exByName: function(name) {
window[name](arguments);
}
};
util.exByName("console.log", "blah");
When I run this, the error 'Uncaught TypeError: window[name] is not a function' however, when I ran this in the browser (Opera):
window["console.log"]("blah");
It works fine. Can someone help me with this?