function reverse(s) { var arr = s.split(','); var arr2 = s.split(' ,'); alert(arr[0].length + ' : ' + arr2[0].length); }; reverse('43.262767791748 ,76.9411392211914');