var VariableName = {
Test: function () {
alert("test");
}
};
window["VariableName.Test"]();
This give error. how to call test function?
If you're trying to use strings for the object and property names, you can do it like this:
window["VariableName"]["Test"]();
But, if you already know the names, it can just be this:
window.VariableName.Test();
or this if only the Test name is know ahead of time:
window["VariableName"].Test();
VariableNamein global scope,window['VariableName']['Test']()orwindow.VariableName.Test().