Changed the js variable of p loop to y

I assume its because both loops were using variable i.