Despite this being the method approved of in several stack overflow answers, and two tutorials I've read so far, I cannot manage to call a method in javascript by dynamically generating the name without getting the console error:
Uncaught TypeError: undefined is not a function
How can I dynamically call a method?
My current code, which fails in both my Rails app and jsfiddle (you can see the fiddle here)
var foo = "hello_";
var bar = "world";
var function_name = "say_" + foo + bar;
window[function_name](" World!");
function say_hello_world(the_word)
{
alert("Hello " + the_word);
}
Thanks in advance.