Hi I have a string a word currently and I'd like to send it in a socket like that :
If I have the word "problem", it send first : p, then pr, them pro, then prob, then probl, then proble, and finally problem but with a delay of x millisecond between each send so I've made this :
i is a random integer WORDS is an array of strings.
for (var l = 1; l <= WORDS[i].length; l++) {
// send 1 ... WORD_LENGTH
console.log(l);
setTimeout(function () {
// send length of the word and the word
cconsole.log(l + ": " + WORDS[i].substring(0, l)); // send me a WORD directly on the first try
}, 325 * l);
}
The problem is that it send me the word directly.
Thanks.