Hi All!
I'm working on a javascript which loops a set number of times. When it loops I want to generate some functions with dynamic names that I can call later in my code. Though, I'm having a hard time getting this to work. Here's the code within my loop to generate my funtions:
slide_number=slide_number+1;
function this["slide"+slide_number](){
alert ('yo');
}
Later I would like to call on the functions slide1(), slide2(), etc... but the code pukes on the above before I can even call the functions. Any thoughts on syntax here? Thanks!
I'm working on a javascript which loops a set number of times. When it loops I want to generate some functions with dynamic names that I can call later in my code. Though, I'm having a hard time getting this to work. Here's the code within my loop to generate my funtions:
slide_number=slide_number+1;
function this["slide"+slide_number](){
alert ('yo');
}
Later I would like to call on the functions slide1(), slide2(), etc... but the code pukes on the above before I can even call the functions. Any thoughts on syntax here? Thanks!