Advertisement
Lulunga

towns

Jun 28th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  function printTableAsJson(params) {
  2.                 let towns = [];
  3.  
  4.                 for (let i = 0; i < params.length; i++) {
  5.                     let [town, latitude, longitude] = params[i]
  6.                         .split(' | ')
  7.                         .filter(e => e !== '')
  8.                         .map(e => e.trim());
  9.  
  10.                     towns.push({
  11.                         town: town,
  12.                         latitude: Number(latitude).toFixed(2),
  13.                         longitude: Number(longitude).toFixed(2)
  14.                     });
  15.                 }
  16.                 towns.forEach((el) => { console.log(el); });
  17.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement