JSFiddle - React, Tailwind, and code Playground

by Sean Olson

HTML

<h2>directions</h2>
<ul id='output'><li></li></ul>

JavaScript

var inpt = ['-574 6072 1993 6072', '-97 1668 -97 -7383', '3152 1368 1999 -3499', '-9842 -317 -6589 -317', '9406 -1301 9406 -8331', '-8670 507 -8670 507', '-5274 -6714 5486 -6714', '-5644 -760 -6477 -760', '9069 1837 3719 1837', '3855 9291 -6219 9291', '1440 7004 -9230 3889', '2287 -4966 7678 -4966', '-4057 -2317 9848 3207', '7512 -4858 7998 -4858', '-7599 -9021 -4827 2234', '6700 -2819 7068 -8062', '-1479 3757 -3068 3757', '-582 3518 297 -5391', '4178 9941 4178 9941', '9364 9744 9364 2279', '7879 9550 7879 9550', '9272 6403 9272 6403', '7296 3027 7296 4301', '-8883 -984 2498 -984', '5204 1196 5204 -2898', '-5709 5298 -2960 -6334', '9336 2138 9336 2138', '-2809 -5777 -2809 -5777', '-489 -3110 7687 5485', '2655 9637 2655 3223', '-1669 -344 -1669 -344', '3571 7372 3571 7372', '-4733 7893 6399 7893', '-9622 -2595 -9622 -2595', '-7208 -393 -7208 4699', '8487 -4665 8487 -4665', '1979 4173 1979 -5794', '-3952 5057 -4012 5057', '-1513 5723 4676 -8478', '-7272 5906 -7272 5906'],
line,
ary,
direction,    
opt = '';    


for (var i = 0; i < inpt.length; i++){
	line = inpt[i];
	var ary = line.split(' ');
	var direction = '',
		dif_long = ary[2] - ary[0],
		dif_lat = ary[3] - ary[1];

	if (dif_lat !== 0){direction = (dif_lat > 0) ? 'N' : 'S';}
	if (dif_long !== 0){direction += (dif_long > 0) ? 'E' : 'W';}
	if (direction === '') {direction = 'here';}
	//console.log(respsonse);
    //done for the purpose of creating an html output
    opt += '<li>' + direction + '</li>';
   
}
document.getElementById('output').innerHTML = opt;