Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arr) {
- let input = arr.slice();
- output = [];
- input.shift()
- for (i = 0; i < input.length; i += 1) {
- let obj = {},
- line = input[i].replace(/\|/gi,'').trim().split(' ');
- obj['Town'] = line[0];
- obj['Latitude'] = Number(line[1]);
- obj['Longitude'] = Number(line[2]);
- output.push(JSON.stringify(obj));
- }
- console.log(`[${output.join(',')}]`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement