Any reason why you're combining let and var declarations in tflLogic.js ?
let westbound = [];
let eastbound = [];
var arr = data.map((value)=>[value.platformName, value.towards, value.timeToStation]);
var sorted = arr.sort((a, b) => {
return a[2] - b[2];
})
Let is block scoped and var is not, see here for further info (in general, var is virtually never needed if you're working in an environment which allows ES6 syntax).
Aside from that, all of these variables (westbound, eastbound, arr, sorted) are not redefined anywhere in your code, so you can store them as constants to ensure that don't get overridden by mistake;
Thanks for your detailed response. The plan is to have the site refresh via setInterval so that the train arrival times refresh every few seconds. Therefore I will change the VARs to LETs.
Any reason why you're combining let and var declarations in tflLogic.js ?
Let is block scoped and var is not, see here for further info (in general, var is virtually never needed if you're working in an environment which allows ES6 syntax).
Aside from that, all of these variables (westbound, eastbound, arr, sorted) are not redefined anywhere in your code, so you can store them as constants to ensure that don't get overridden by mistake;
See here