code:
for (i = 0; i <= textray.length; i++){
for (k = 0; k <= (textray[i] ? textray[i].length : 0); k++){
if (textray[i].substring(0,4)=="http") {
text = textray[i] + text;
}else{
text = textray[i].substring(k, k+1) + text;
}}}
Just a few things first, textray is an array formed by str.split(" ");, text is a blank predefined variable and str is the message typed in.
I get the error "'undefined' is null or not an object." on the lines with substring on them.
What I was trying to do here, if you can't see it, is reverse the words, and if a word is a link, don't reverse it. The problems only started when I began to use the array. I just used the string before.
Say if you do need more of the script. If it's easier for you, you can just rewrite the code