Javascript dynamically invoke object method from string
if the name of the property is stored in a variable, use []
foo[method]();
Properties of objects can be accessed through the array notation:
var method = "smile";
foo[method](); // will execute the method "smile"