When you do this setTimeout(function(arr[c]) {
You are defining a new function and saying that I want this function to accept a parameter called 'arr[c]', you aren't saying that you want to pass arr[c] to it and because you can't have any special characters in the name of a parameter you get an error. What you should do is define a function outside of the loop to avoid the loop closure issue and pass the parameter to that letting that function create the setTimeout for you. Please see JavaScript closure inside loops – simple practical example for more information about closures. Also read this to learn more about javascript functions: http://javascript.info/tutorial/functions-declarations-and-expressions
This is the correct code below:
var arr = ["Just a test","I miss you so much darling #$%&%@;..\]]/"];
console.log(arr);
for(var c=0; c < arr.length; c++){
console.log(arr[c]);
setTimeoutFactory(arr[c]);
}
function do_magic (passed_var){
console.log(passed_var);
}
function setTimeoutFactory(text) {
setTimeout(function() {
do_magic(text);
}, 1000);
}