Advertisement
TZinovieva

Towns JS Fundamentals

Feb 24th, 2023 (edited)
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function towns(arr) {
  2.     let townData = {};
  3.  
  4.     for (let row of arr) {
  5.         let [town, latitude, longitude] = row.split(' | ');
  6.  
  7.         townData.town = town;
  8.         townData.latitude = Number(latitude).toFixed(2);
  9.         townData.longitude = Number(longitude).toFixed(2);
  10.  
  11.         console.log(townData);
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement