Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- for(let i = 0; i < input.length; i++){
- let [name, latitude, longitude] = input[i].split(' | ');
- let town = {
- town: name,
- latitude: Number(latitude).toFixed(2),
- longitude: Number(longitude).toFixed(2)
- };
- console.log(JSON.stringify(town));
- }
- }
- solve(['Sofia | 42.696552 | 23.32601', 'Beijing | 39.913818 | 116.363625']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement