What is the problem?
function text(text) {
characters = ['a','b','c','d','e','f'];
// POINT 1 outputs correctly
textdone='';
for(i=0;i<characters.length;i++) {
textdone = $('#battletxt').text();
character=characters[i];
// POINT 2 outputs correctly
setTimeout(
function(textdone,character) {
alert(character);
// POINT 3 outputs all NULL
$('#battletxt').text(character);
},100);
}
}
At point 3 for some reason, the code alerts a message that says undefined.
Does anyone know what is causing this problem or how to fix it?
Thanks.






Cartoon Clouds
Mountains
Sunrise
Clouds
Green Clouds
None



















Help