I think you want to write this
for (var i = 0; i <= str.length; i++)
instead of this
for (int 0 = 1; i <= str.length; i++)
So the problem is that there is nothing like int in javascript, and you are also using 0=1 , which makes no sense. Just use the i variable with the var keyword.
source share