Uncaught TypeError: object is not a function
I decided to make my writeMessage() function anonymous; before it would always mess up when another instance of the writeMessage() function was created at the same time, causing text output to be jumbled (both messages being "wrote" would get put together and mixed up).
However, I've seen to have run into an error (as shown above). The variable object is a jQuery object (e.g: $('#myDivElement')).
Any ideas as to why this is? Thanks.
function writeMessage(message,object){
(function(message,object,i){
var self = this;
setTimeout(function(){
if(i < message.length){
object.append(message.substr(i,1));
i++;
self(message,object,i);
}
}, 25);
}(message,object,0));
}