This is because textArea doesn't care about linebreaks , just a space. So the solution is to divide by ' ' , and then combine each of the two (or feed each pair directly into the control array and check their contents on the fly).
Edit:
So the problem is in this line:
var check = coordinates[ i ].match( /^([0-9]+.[0-9]*) ([0-9]+. [0-9]*)$/ )
It assigns only one value instead of two.
user2509223
source share