this style of for loop over arrays is generally considered dangerous. Use

for (var i = 0; i < axes.length; i++) { ... }

instead