Dynamic function call
by jasper502
JavaScript
function a() {
alert('function a!');
}
function b() {
alert('function b!');
}
var myFunctions = {
a: a,
b: b
}
x = 'b';
myFunctions[x]();
by jasper502
function a() {
alert('function a!');
}
function b() {
alert('function b!');
}
var myFunctions = {
a: a,
b: b
}
x = 'b';
myFunctions[x]();