function reverse(s) { var arr = s.split(','); return arr[1] + ', ' + arr[0]; }; console.log(reverse('43.262767791748 ,76.9411392211914')); // 76.9411392211914, 43.262767791748