When you write:
for (i = 0; i === tries; i += 0) {
the loop repeats as long as the condition i === tries
is true. If tries
is 3, for instance, this condition is not true on the first iteration, and the loop ends immediately.
You should write:
for (i = 0; i < tries; i++) {