Just get rid of the highlighted line and you will be good to go. The reason for the error is that you are trying to set the parent.location with a variable (i) that hasn’t been declared yet (it is declared in the function)