I can\'t really figure out why calling this function in a setInterval causes TypeError: n is undefined. Without the setInterval it works perfectly fine.
TypeError: n is undefined