I have several jQuery function like
function setOne();
setTwo(); setThree();
and a variable var number that values respectively “one”, “two”, “three”.
How can I call function “setOne()” when number values “one”, function “setTwo” when number values “two” and so on…?
Thank you so much in advance. Any help will be apreciated.
If you have your function in the global scope (on the window object) you can do:
And using
evalwill allow you to run functions in local scope:When is JavaScript’s
eval()not evil?