I have registered some javascript functions in the global scope:
function Test1() {}
function Test2() {}
Now I want to run all javascript functions whose name starts with 'Test', how to do it?
I want to prevent saving each functions into a variable because it does not scale. Nor to push them to a queue and execute them later, since people need to remember adding their functions to the queue when they write the test and I don't want that.
windowand check whether it starts withTest? But since there are lots of things in global scope, maintaining your own list is probably better. Naming variables/functions with consecutive numbers is a string sign that you should be using an array instead. "I want to prevent saving each functions into a variable because it does not scale." Can you elaborate what you mean?I want to prevent saving each functions into a variable because it does not scale.Can you elaborate on this, because it doesn't sound right.