The problem:
I'm parsing the input file and loading it into a simple structure. The file contains labels of types of locations, and coordinates of various examples of said locations. The parser starts by checking if the first character of the line is a '#'. If so, it uses the tail of the line to push a new instance of a Location object into an array with the tail as it's label. If not, it passes the line to the coordinate function, which either appends a set of coordinates to the appropriate member of the top element of the Locations array, or returns an integer that is keeping track of the top of the array. That integer is the variable i. And after 3 lines have been parsed it becomes undefined.
For the life of me I can't figure out why. Testing it in chrome.
EDIT: changing line 27 to
locations[locations.length-1] fixed the issue, getting rid of i. Too used to programming in C and lisp. New to javascript. Now I just gotta get formatting right :P